+ Reply to Thread
Results 1 to 9 of 9

Thread: Trying to make this php code work...

  1. #1

    Trying to make this php code work...

    Hello All,

    I am trying to make the following code (a modified version of)
    https://css-tricks.com/snippets/php/...sed-on-season/

    in that it will be used to display a different css file (instead of a graphic) based on the season...The code does work, but I want to create a smarty variable for it and when I did, I ran into problems.

    Here's the code in my includes/controllers/common.inc.php file:

    PHP Code:
    Only registered members can view the code
    In my head.tpl
    Code:
    Only registered members can view the code.
    In my header.tpl
    Code:
    Only registered members can view the code.
    The page is showing like normal, but in the spring.css I have only one css definition for the body and that is:
    Code:
    Only registered members can view the code.
    That should change the body of the page to white, but it's not changing. Is this because I have to remove the body css from the flynax style.css for it to work? What will make it work? The reason behind using this script is so that I won't screw up my original style.css file.

    Brian

  2. #2
    Master
    Join Date
    Apr 2017
    Location
    Tehran/Iran
    Posts
    457
    Hello Brian,

    I think you should use id attribute in body tag.

    head.tpl: change <Body ...> to: <Body ... id="season">

    Then use #season { background : #...; } instead of Body { background : #...; } in spring.css and others.

  3. #3
    Quote Originally Posted by Bahram Soltanirad View Post
    Hello Brian,

    I think you should use id attribute in body tag.

    head.tpl: change <Body ...> to: <Body ... id="season">

    Then use #season { background : #...; } instead of Body { background : #...; } in spring.css and others.
    That did not work, I also adjusted the path (to {$rlTplBase}css ) for each of the css files and moved them into my {$rlTplBase}css folder as well.

  4. #4
    By the way, this is running from my localhost, not from my live domain.


    Here's is the changes I made:

    includes/controllers/common.inc.php (Changed the array so that it reflect to the templates css folder)

    PHP Code:
    Only registered members can view the code
    Head.tpl ( I added the "season" id to the body tag as shown )
    Code:
    Only registered members can view the code.
    spring.css
    Code:
    Only registered members can view the code.
    Brian
    Last edited by Brian Jester; May 20, 2018 at 03:00 PM.

  5. #5
    Quote Originally Posted by Brian Jester View Post
    By the way, this is running from my localhost, not from my live domain.


    Here's is the changes I made:

    includes/controllers/common.inc.php (Changed the array so that it reflect to the templates css folder)

    PHP Code:
    Only registered members can view the code
    Head.tpl ( I added the "season" id to the body tag as shown )
    Code:
    Only registered members can view the code.
    spring.css
    Code:
    Only registered members can view the code.
    Brian
    Anyone see anything wrong that I am not with the above code?

  6. #6
    Hello Brian,

    Try to use my code:

    in the ond of file common.inc.php:

    PHP Code:
    Only registered members can view the code
    in the file head.tpl put this code:
    Code:
    Only registered members can view the code.
    I hope it should work.
    Viktor,
    Flynax technical department,
    Best wishes.

  7. #7
    Is this code for effect for season? Like snowing in winter, yellow leaves in Autumn Fall?

  8. #8
    Quote Originally Posted by Viktor View Post
    Hello Brian,

    Try to use my code:

    in the ond of file common.inc.php:

    PHP Code:
    Only registered members can view the code
    in the file head.tpl put this code:
    Code:
    Only registered members can view the code.
    I hope it should work.
    Thank you Viktor, you always come through with a working solution!

    Thanks again!
    Brian

  9. #9
    Quote Originally Posted by Wei Hong View Post
    Is this code for effect for season? Like snowing in winter, yellow leaves in Autumn Fall?
    Yes Wei Hong, if you check the source, you will see:
    https://css-tricks.com/snippets/php/...sed-on-season/

    I had to modify it a bit, not too much to make it change css files instead of images.

    Brian

+ Reply to Thread