Jorgeluiz Posted December 20, 2014 Share Posted December 20, 2014 Hi, I need help.I have a cms page that has online webcam an office. My goal is to turn off (hide) this webcam.I'm trying to use a script (it works on another site) but in PS 1.6 not.The script is this:{if $cms->id==5}{literal}{assign var="ip_address" value=$smarty.server.REMOTE_ADDR}{if $smarty.now|date_format:"%A"=="Monday" OR $smarty.now|date_format:"%A"=="Tuesday" OR $smarty.now|date_format:"%A"=="Wednesday" OR $smarty.now|date_format:"%A"=="Thursday" OR $smarty.now|date_format:"%A"=="Friday"}{if $smarty.now|date_format:"%H:%M">="08:00" and $smarty.now|date_format:"%H:%M"<="18:30" }{if $ip_address eq "177.19.170.147" OR $ip_address eq "177.19.170.147"}{/literal}{/if} What's wrong? Thanks for the help. Jorge Link to comment Share on other sites More sharing options...
tuk66 Posted December 22, 2014 Share Posted December 22, 2014 Where you want to use this code? In /themes/*/cms.tpl? This could work {if $cms->id==5} {assign var="ip_address" value=$smarty.server.REMOTE_ADDR} {if $smarty.now|date_format:"%A"=="Monday" OR $smarty.now|date_format:"%A"=="Tuesday" OR $smarty.now|date_format:"%A"=="Wednesday" OR $smarty.now|date_format:"%A"=="Thursday" OR $smarty.now|date_format:"%A"=="Friday"} {if $smarty.now|date_format:"%H:%M">="08:00" and $smarty.now|date_format:"%H:%M"<="18:30" } {if $ip_address eq "177.19.170.147" OR $ip_address eq "177.19.170.147"} ... something to show ... {/if} {/if} {/if} {/if} Link to comment Share on other sites More sharing options...
vekia Posted December 22, 2014 Share Posted December 22, 2014 it's not a js script, so literal tags arent necessary.you used smarty syntax. you have to use {literal} tags only if you will use js scripts Link to comment Share on other sites More sharing options...
Jorgeluiz Posted December 22, 2014 Author Share Posted December 22, 2014 Thank tuk66 and Vekia.I'll do a test and post the results tomorrow. Link to comment Share on other sites More sharing options...
Jorgeluiz Posted December 26, 2014 Author Share Posted December 26, 2014 (edited) Tried with the following code. but not turned off the cam. {if $cms->id==5} {assign var="ip_address" value=$smarty.server.REMOTE_ADDR} {if $smarty.now|date_format:"%A"=="Monday" OR $smarty.now|date_format:"%A"=="Tuesday" OR $smarty.now|date_format:"%A"=="Wednesday" OR $smarty.now|date_format:"%A"=="Thursday" OR $smarty.now|date_format:"%A"=="Friday"} {if $smarty.now|date_format:"%H:%M">="08:00" and $smarty.now|date_format:"%H:%M"<="18:30" } {if $ip_address eq "177.19.170.147" OR $ip_address eq "177.19.170.147"} "http://177.19.170.147:8899" {/if} {/if} {/if} {/if} the strange thing is that this code worked on the old site. Still has something wrong. Thanks and Merry Christmas Edited December 26, 2014 by Jorgeluiz (see edit history) Link to comment Share on other sites More sharing options...
Jorgeluiz Posted January 7, 2015 Author Share Posted January 7, 2015 it's not a js script, so literal tags arent necessary.you used smarty syntax. you have to use {literal} tags only if you will use js scripts Hi Vekia, I don't have enough knowledge in Smarth. Do you have any suggestion to make the php up in Smarth? Tanks Link to comment Share on other sites More sharing options...
Recommended Posts