how to access "node.subject" and "location.local_node.subject" in the same macro

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

how to access "node.subject" and "location.local_node.subject" in the same macro

nnako
Hi,

I want to modify the title row within a notification email. I want to do this in order to tell the user exactly where his SUBSCRIPTION was set and at the same time, from which SUBFORUM the post is coming from. In general, these two can be different.

I tried this for modifying the "instant_html" macro, but somehow, it does not work:

<override_macro name="instant_html" requires="subscription,node_page">
    <n.set_local_subscription.this_subscription/>
    <n.set_local_node.page_node.get_app_node/>
    ...
    <div style="color:#666; font: 11px tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em;line-height:1.5em">
        <n.if.equal value1="[n.node.subject/]" value2="[n.location.local_node.subject/]">
            <then>
                <n.node.subject/><br/>
            </then>
            <else>
                <n.node.subject/> ... <n.location.local_node.subject/> <br/>
            </else>
        </n.if.equal>
    </div>
    <br/>
    <n.page_node.html_email_message_with_signature/>
    <br/>
    <br/>
    ...
</override_macro>

Where do I get the "location.local_node.subject" from, which was used successfully e.g. in the macro "start_new_topic_line"?

Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: how to access "node.subject" and "location.local_node.subject" in the same macro

nnako
Hi again,

is there really no help available for my question? Is there at least some information source where I could read something general about creating variables and using them? No clue about what I am missing?

Any hint would be really nice.

Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: how to access "node.subject" and "location.local_node.subject" in the same macro

Mencey Melgar
In reply to this post by nnako
Hello nnako,

I don't get at all your request, could you explain it better?
Anyway, I invite you to take a look to the "app_subscription_controls" and "menu_subscription" macros, you might find some useful info there ;)
:) Helper
Reply | Threaded
Open this post in threaded view
|

Re: how to access "node.subject" and "location.local_node.subject" in the same macro

nnako
Hello LouK,

thanks for your reply.

Here is what I want to do.

This is the current NAML code for the macro "instant_html" which I am using to create the notification emails:
instant_html.NAML
Nothing special, yet.

And this is the result (explanations follow below the picture). Please excuse the German language, as it is a screen shot:
current eMail notification

Now, the RED underlined strings are generated using the term "n.node.subject", as e.g. seen in the macro code snippet above. "n.node.subject" seems to be set according to the subforum where the particular user has his SUBSCRIPTION. The BLUE underlined string is generated within the macro "start_new_topic_line" and is built using something line the NAML term "n.location.page_node.get_app_node.subject", which kind of has to be split up into parts to be operational in NAML (please see the mentioned macro code). The BLUE portion seems to be set according to the subforum where the message was generated (not necessarily the same as the subscribed subforum but maybe some levels below).

I want the BLUE portion not only to be mentioned in the footer of the notification but also in the title (BLACK in the picture). Thus, the users receiving the notification know EXACTLY what they subscribed and at the same time, where the message was posted. As it is both written in the header of their notification.

My problem is that I can't figure out, how to integrate the split-macro-term for "n.location.page_node.get_app_node.subject" into the macro "instant_html" in order to get it printed out into the header of the the notification email by code from the macro "instant_html".

Any ideas?

Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: how to access "node.subject" and "location.local_node.subject" in the same macro

Mencey Melgar
Hi there again,

I managed the code to add the Subforum name (the "BLUE" one) but we have a problem... At this point, I noticed that when you reply to the email, it creates a new topic with the subject name. I leave you the code here so you'll be abled to make tests:

note: you have to override the "send_subscription_email"

<override_macro name="send_subscription_email" parameters="node_attr,text_part,html_part" requires="subscription">
    <n.set_local_subscription.this_subscription/>
    <n.set_local_node.node_attr/>
    <n.block.>
        <n.new_email.>
            <n.send>
                <to.local_subscription.user.user_email/>
                <to_name.local_subscription.user.name/>
                <from.local_subscription.user.reply_address_for.local_node/>
                <from_name>
                    <n.local_node.owner.name/> [via <n.root_node.subject/>]
                </from_name>
                <subject>
                    <n.local_node.subject/>
                    <t>App parent: <t.location.local_node.get_app_node.subject/></t> 
                </subject>
                <text_part.text_part/>
                <html_part.html_part/>
                <set_headers_for.local_node/>
                <bounce_to.local_subscription.user.bounces_address/>
            </n.send>
        </n.new_email.>
    </n.block.>
</override_macro>
:) Helper
Reply | Threaded
Open this post in threaded view
|

Re: how to access "node.subject" and "location.local_node.subject" in the same macro

nnako
Hi LouK,

thanks for your replies :-)

I will continue with this subject in a short time...

But now, just a comment about your mentioned problem where replies are not appended to the original thread but started as new threads within the original subforum. One year ago, I was wondering about exact the same issue and started a post. It was discussed on a superficial level but not answered, finally. If you like, you could follow the link and read it.
Reply | Threaded
Open this post in threaded view
|

Re: how to access "node.subject" and "location.local_node.subject" in the same macro

nnako
In reply to this post by Mencey Melgar
Hi LouK,

here my thoughts about your proposed solution:

You are adding the name of the subforum to the SUBJECT part of the notification eMail. But I'd like to use it within the BODY part of the notification eMail because this would fit to my concept. My first idea was, thus, to take the variable defining part from the macro "start_new_topic_line" and paste it into the macro "instant_html" to be able to use the object within macro "instant_html":
<n.set_local_node.page_node.get_app_node/>
As the required macro parameters seem to fit, why should there be any hidden requirement? But it doesn't work like this, and there is no way to find out except asking questions in this support forum and wait for answers.

You know, I just want to in-depth understand the syntax of NAML in this. Concerning the proper usage of parameters, variables,... In order to be free to create my own solutions without having to ask one question after the other here in the "support forum". Given the proper technical / structural documentation or general knowledge, I could find the solutions for most of my problems myself. But documentation does not seem to be on any priority list, yet.

Maybe there would be another idea to include the original subforum name into the body text of a notification eMail?

Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: how to access "node.subject" and "location.local_node.subject" in the same macro

Mencey Melgar
Hello nnako,

I've been investigating and it seems that the correct macros you need to edit are "instant_text" and "instant_html" (referenced in the "send_instant_email" macro).

I'm not an expert in NAML so I can't help you too much more, it seems that you know more than me :) I recommend you to make tests and you'll find the answer.

Regards
:) Helper
Reply | Threaded
Open this post in threaded view
|

Re: how to access "node.subject" and "location.local_node.subject" in the same macro

nnako
Hi LouK,

thanks anyway. It is good to see that there are at least some people trying...

Maybe, we (you and I) could support the creation of reasonable technical documentation for NAML. Otherwise, the problem of missing documentation will continue to persist, as every interested user / developer will eventually run into the same problems (which partly had been solved but no one knows about the solution anymore). I have not yet found any technical documentation about NAML which talks about the following subjects which I think are essential for any solution-finding in any programming language. Even if these subjects have a different name in NAML, effectively everything breaks down to such:

- definition and usage of LOCAL and GLOBAL VARIABLES and CONSTANTS
- overview and usage of all the available PROGRAMMING STRUCTURES (loops, conditions, exceptions,...)
- overview and usage of BUILT-IN functions (compress, truncate,...)
- how to create own FUNCTIONS (and usage of parameters, dot_parameters, requires, ...)
- overview and structure of usable OBJECTS (subscription, node, page, user,...)
- ...

If you, as an official helper, have an idea for me how to practically support for this task, please let me know.

Regards.
Reply | Threaded
Open this post in threaded view
|

Re: how to access "node.subject" and "location.local_node.subject" in the same macro

Mencey Melgar
Hello nnako,

Im still a helper in this forum but I have a lot of work in my job to do so I just take care of the Spanish support & rarely NAML support. I would like to help you with this guide but as I said, I can't spend a lot of time in this :/

Anyway, Nabble admins announced long time ago that they were planning to change nabble's forums with a new language (and removing NAML) but it seems that this will take time..

The only documentation page I know is naml's documentation but its very basic ..
:) Helper