|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
zoldos Smarty Rookie
Joined: 06 Aug 2013 Posts: 8
|
Posted: Sun Nov 24, 2013 2:40 am Post subject: how do I get Milonic JS Menu to accept Smarty variables? |
|
|
I have a Javascript menu from Milonic. It uses three JS files to display the menu as follows:
Code: | <script type="text/javascript" src="./milonic_src.js"></script>
<script type="text/javascript" src="./mmenudom.js"></script>
<script type="text/javascript" src="./menu_data.php"></script>
|
menu_data.php is normally menu_data.js but I was told by their support that I can change it to PHP. The Smarty variable I want to use is:
Code: | {$url->url_create('profile',$user->user_info.user_username)} | (I'm using Social Engine 3.13) but the menu simply echoes this literally in the browser. I also tried removing the { } and using "<", ">" but it still didn't work. I'm thinking I have to somehow tell the menu to initiate Smarty before it will work but I don't know how to do this.
Can anyone offer any ideas or help? Thanks! |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sun Nov 24, 2013 2:11 pm Post subject: |
|
|
Your javascript files will be included by your browser on the client.
They don't run through Smarty the server. The only way would be that you pass Smarty variables in the template files as parameter when the JS functions get called. |
|
Back to top |
|
zoldos Smarty Rookie
Joined: 06 Aug 2013 Posts: 8
|
Posted: Sun Nov 24, 2013 10:56 pm Post subject: |
|
|
U.Tews wrote: | Your javascript files will be included by your browser on the client.
They don't run through Smarty the server. The only way would be that you pass Smarty variables in the template files as parameter when the JS functions get called. |
How can I do this? I know I can "call" JS functions from inside the menu. Can I somehow create a function that captures the username and creates the correct URL then call this from the menu? |
|
Back to top |
|
zoldos Smarty Rookie
Joined: 06 Aug 2013 Posts: 8
|
Posted: Tue Nov 26, 2013 5:07 am Post subject: |
|
|
Figured it out by switching to a list style menu where each menu item is plain HTML. Thanks tho! |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|