Help - Search - Members - Calendar
Full Version: Smarty Problem?
Movable Type Community Forum > Additional Resources > Tips and Tricks
heyitsaj
I am trying to add the MTEntryAuthor to an email template. I tried to use

$email_subject = $this->tag('MTEntryAuthor'); but I get the following:

Fatal error: Call to a member function on a non-object

Any ideas? Is there an easier way to do this? The email form is a php template that is used as an include file
kevin67
Just to clarify, this is PHP not Smarty.



Smarty would look something like this:



CODE
{{capture assign="email_subject"}}<MTEntryAuthor>{{/capture}}




But I digress, are you using static or dynamic templates? it should be set to dynamic.



Also make sure you're using the full
CODE
<?php ?>
heyitsaj
Thanks for your reply. To back up a step here is the scenario:

1. All my pages are set to publish as static using .php extension
2. I have created a standard email form in php that I use across several blogs
3. I call the form using .inc from my blog entry body

What I am trying to do is force the subject of the email to be the Parent Categories hierarchy for the entry

So as an example:
My pet food blog has an entry in the categories/subcategories Food / Dog / Dry Food
When I call the contact form include I want the subject of the email to automatically be Food / Dog / Dry Food which should be accessible via the MTCategory tag group. This code would be part of the included php email form and not have to be passed by the entry.
kevin67
I don't really have time to help you, since I'm at work. But FYI, I don't think smarty doesn't work with static templates.
Annoying Old Guy
That's fundamentally broken. If you are static publishing, all MT related data is processed when the file is written to disk. There is no connection to MT after that from any of the files, that's what makes it static. To make this work, the email form PHP logic would have to take arguments to specify per entry data and then, from each entry, call the email form logic passing in statically generated per-entry values. E.g.

CODE
// In each entry template
<?php generate_email_form('<$MTAuthorName$>','<$MTEntryCategory$>'); ?>
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.