Hi,
Garvin has given a hint solving this by refering to the FAQ.
http://board.s9y.org/viewtopic.php?t=87 ... p+template
I want to try this using the "The "hackish but even easier way" at the moment. It works fine, but I have trouble assigning the value of a CustomField (TFHUser) to a PHP variable. It doesn't work, the variable is empty.
What goes wrong? Sorry for my simple question...
Juergen
<div class='serendipity_comment'>
{$entry.properties.ep_TFHUser} <--- only for test, it works
{php}
$leiter=$entry.properties.ep_TFHUser; <--- $leiter is still empty
include ('http://www.mydomain.de/foo/bar/proj.php');
{/php}
</div>
templates and PHP code again
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: templates and PHP code again
Hi!
HTH,
Garvin
That won't work. PHP addresses variables differently, you need to use{php}
$leiter=$entry.properties.ep_TFHUser; <--- $leiter is still empty
include ('http://www.mydomain.de/foo/bar/proj.php');
{/php}
</div>
Code: Select all
$leiter = $entry['properties']['ep_TFHUser'];
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Re: templates and PHP code again
Not really. $leiter is still empty. Please look at the bottom ofgarvinhicking wrote:HTH,Code: Select all
$leiter = $entry['properties']['ep_TFHUser'];
http://blog.juergen-luebeck.de/archives ... urity.html
for an example. 'icke' is the value of $entry.properties.ep_TFHUser
My code for testing in entries.tpl is now:
Code: Select all
<div class='serendipity_comment'>
{$entry.properties.ep_TFHUser}
</div>
<div class='serendipity_comment'>
{php}
$leiter = $entry['properties']['ep_TFHUser'];
echo 'echo in PHP: '.$leiter;
{/php}
</div>
Code: Select all
$serendipity['smarty']->security = false;Juergen
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: templates and PHP code again
Hi!
Hm, Maybe the variable $entry is not available. Do a print_R($GLOBALS) in your PHP section and search for where you find the variable?
Else you might need to register a custom smarty modifier/function via config.inc.php (which is also covered in the FAQ, AFAIR).
HTH,
Garvin
Hm, Maybe the variable $entry is not available. Do a print_R($GLOBALS) in your PHP section and search for where you find the variable?
Else you might need to register a custom smarty modifier/function via config.inc.php (which is also covered in the FAQ, AFAIR).
HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/