1
mqualls
Accessing PHP variables from template? How to?
  • 2004/7/22 13:44

  • mqualls

  • Just popping in

  • Posts: 2

  • Since: 2004/7/22


According to this page on Smarty's Web site:

PHP Variables in Smarty Templates

You should be able to access a PHP variable from the template...However, I am having a rough go of it...

This is what I have put in the "mylinks_topten.html" template:

<{if $rate == 1}>
Top Rated Links
<{else}>
Most Popular Links
<{/if}>

It, as you might guess, is executing the else clause every time....Any ideas on what I am doing wrong? Do I need to make some sort of explicit reference to the PHP variable in order to access the value from the template? Thanks!

2
dheltzel
Re: Accessing PHP variables from template? How to?
  • 2004/7/22 15:13

  • dheltzel

  • Not too shy to talk

  • Posts: 164

  • Since: 2003/1/8 1


Put this line in the .php file to make the variable visible to Smarty:

$xoopsTpl->assign('rate', '1');

Also, you might try using 'eq' instead of '==' like this:

<{if $rate eq '1'}>

Dennis

3
mqualls
Re: Accessing PHP variables from template? How to?
  • 2004/7/22 15:18

  • mqualls

  • Just popping in

  • Posts: 2

  • Since: 2004/7/22


Thanks for the reply...Am now traveling down the path you suggested...Probably did not dig enough before posting my question....Thanks again!

Login

Who's Online

314 user(s) are online (143 user(s) are browsing Support Forums)


Members: 0


Guests: 314


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits