1
franciscohm
Why smarty tags do not work sometimes?

Hi everybody,

Something is getting me mad... While Smarty Tags work perfectly for themes and modules in my Xoops-site, they actually do not work when I try to use them in any of theses cases:

a) HTML blocks
b) Content-Wrapping modules such as CJ-Content or WF-Channel.

For instance, if I put "<{$xoops_uname}>", I get literally "<{$xoops_uname}>" instead of "my_user_name".

What is happening? Do I need to set up anything in order to make it work?

Please help...

Cheers
Francisco

2
franciscohm
Why smarty tags do not work sometimes? SECOND PART

I have tried to make smarty tags work by making this simple php page:

include("../mainfile.php");
include(XOOPS_ROOT_PATH."/header.php");
?>

The content of your original html file goes here!!

<{$xoops_uname}>

include(XOOPS_ROOT_PATH."/footer.php");
?>

and it displays:

The content of your original html file goes here!!

<{$xoops_uname}>

Why??

Do I need to configure anything in the server side?

3
Herko
Re: Why smarty tags do not work sometimes? SECOND PART
  • 2006/10/7 21:07

  • Herko

  • XOOPS is my life!

  • Posts: 4238

  • Since: 2002/2/4 1


You have to understand how smarty works. Smarty is basically a shorthand writing style for dynamically assigned variables for PHP. In the PHP files, the variables are assigned to Smarty variables, to be interpreted by the rendering sequences of the code. If you add references to variables without having assigned any values to them, or to code that already has been interpreted by the rendering codes (such as you're doing in both cases), this will fail.

Basically, the order in which this needs to be done is this:
php script defines smarty variables to dynamically assign values to;
html script gets interpreted by rendering code, which puts the dynamic values to the assigned smarty variables;
display the content.

You're trying to add a nexts tep, which is actually the second one.

I hope that makes it a bit more clear for you.

Herko

4
franciscohm
Re: Why smarty tags do not work sometimes? SECOND PART

Hi Herko,

Thanks very much for your piece of advise. That actually helps me to understand what is actually happening with smarty tags and my website.

However I do not have it clear (in practical terms, sorry my knowledge of programming is not very high) how I can solve the issue (which basically is displaying user's name in some personalised pages I have to connect to my XOOPS platform).

Is there any guide I can check?

Francisco

P.D.: For what I understand the underlying issue is how to put the smarty tag before the php code is interpreted.

5
wizanda
Re: Why smarty tags do not work sometimes? SECOND PART
  • 2006/10/8 8:40

  • wizanda

  • Home away from home

  • Posts: 1585

  • Since: 2004/3/21


As you are trying to add it into the module it self...

If you add it into the template for the module, where you need it to display; then Smarty is running the templates system and so should work...

6
franciscohm
Re: Why smarty tags do not work sometimes? SECOND PART

I understand what you mean. But my problem is that I need the "username" to be displayed as the default caption of a form's field, so the form(s) and the templates are different and (as far as I am concerned) I can not set a field's value using my theme.

Am I wrong?

7
wizanda
Re: Why smarty tags do not work sometimes? SECOND PART
  • 2006/10/8 8:52

  • wizanda

  • Home away from home

  • Posts: 1585

  • Since: 2004/3/21


maybe is and as I am also still learning...yet I would think that Smarty being just the template would display who is looking at that moment's user name....
My theme also displays the user name of who is looking, yet it is the module in your case that needs changing not the overall theme...
So as Smarty is likely to be doing the layout for the form to being with...it would be a matter of adding the value for that as the user name?...

Thats a guess and like I say still learning...

8
franciscohm
Re: Why smarty tags do not work sometimes? SECOND PART

Dear Wizanda and Herko,

Thanks for your help but I think I have to explore further to solve my issue. I thought it would be easier, but it does not seem to be so.

Cheers
Francisco

9
iHackCode
Re: Why smarty tags do not work sometimes? SECOND PART

will this post help?

Link..
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧

Login

Who's Online

207 user(s) are online (110 user(s) are browsing Support Forums)


Members: 0


Guests: 207


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