Jump to content

Script on CMS PS 1.6


Recommended Posts

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

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

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 by Jorgeluiz (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

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

×
×
  • Create New...