Results 1 to 10 of 10

Thread: Trying to add random image script to header

  1. #1
    Join Date
    Aug 2007
    Location
    Canada
    Posts
    19

    Default Trying to add random image script to header

    I am trying to add a simple JS random image script to the header.tpl. Basically, I want pages to display one of several images randomly in the header. The problem is that I get a script error:
    Fatal error: Smarty error: [in header.tpl line 34]: syntax error: unrecognized tag 'var' (Smarty_Compiler.class.php, line 590) in /home/eskillet/public_html/include/smarty/libs/Smarty.class.php on line 1095
    Here is what I am adding to the tpl file. I add the following to the <head> section:
    <script type="text/javascript" language="JavaScript">
    <!-- Copyright 2002 Bontrager Connection, LLC
    //
    // Type the number of images you are rotating.

    NumberOfImagesToRotate = 15;

    // Specify the first and last part of the image tag.

    FirstPart = '<img src="{$baseurl}/templates/assets/headerimage';
    LastPart = '.jpg" height="520" width="280">';

    function printImage() {
    var r = Math.ceil(Math.random() * NumberOfImagesToRotate);
    document.write(FirstPart + r + LastPart);
    }
    //-->
    </script>
    and the following in the <body> section:
    <script type="text/javascript" language="JavaScript"><!--
    printImage();
    //--></script>
    Is there any solution to this?

    As well, I see that the header.tpl file applies to all pages. Is there any way to display a specific image in the header of a specific sub page? What I would like to do, ideally, is randomly display header images on the home page, but then display a specific header image in specific sub pages since they will be relevant to the page content.

    Vito

  2. #2
    Join Date
    May 2007
    Posts
    686

    Default

    Yes add this

    {literal}
    YOURCODE

    {/literal}

    Also galnet if you read this i wanna chat to you bout a mod ive got half done.

  3. #3
    Join Date
    Aug 2007
    Location
    Canada
    Posts
    19

    Default

    Cool. That solved the problem. Thanks, zeffer.

    Any thoughts on my second question about being able to display specific images on specific subpages? For instance, if you go to the site and refresh the pages a few times, you will see different food groups. So the idea is that when someone clicks to see videos for "Soup", I want the soup image to display on that page.

    Vito

  4. #4
    Join Date
    May 2007
    Posts
    588

    Default

    Quote Originally Posted by vito
    Cool. That solved the problem. Thanks, zeffer.

    Any thoughts on my second question about being able to display specific images on specific subpages? For instance, if you go to the site and refresh the pages a few times, you will see different food groups. So the idea is that when someone clicks to see videos for "Soup", I want the soup image to display on that page.

    Vito
    see my post on http://forums.buyscripts.in/viewtopic.php?t=639

    if this is what your after i should hopefully have a guide up sometime next week (if i get my current vshare probs sorted soon)

  5. #5
    Join Date
    May 2007
    Posts
    686

    Default

    I think theres 2 easy ways. One uses google adsense...assuming you use it you put it in the view_video.tpl. The other way i cant remember but its on this forum. Search channels.

  6. #6
    Join Date
    Aug 2007
    Location
    Canada
    Posts
    19

    Default

    Hmm. Not sure you understand what I'm looking for. I don't want to display a specific image below the header. I want to specify a particular image in the header of the page. So when going to the Seafood page that shows all seafood video, the seafood image is displayed in the actual header, not below it.

    Vito

  7. #7
    Join Date
    May 2007
    Posts
    686

    Default

    Oh you could just nop out or comment out the parts you dont want with marks and then go to admin create the urls you want then add the links on your home page.

  8. #8
    Join Date
    Aug 2007
    Location
    Canada
    Posts
    19

    Default

    Sorry, I must just not be explaining this right. Let me try again.

    Go to http://www.eskillet.com
    In the header menu, click on Watch All Videos
    Click on the Bread icon

    So on this page, I want to be able to display ONLY the bread image in the header. The problem is that this page uses header.tpl which now has the random image generator. So is there any way to override the header.tpl file and show the bread image all the time on this page?

    Vito

  9. #9
    Join Date
    May 2007
    Posts
    588

    Default

    yes it should still work...as long as the channel name variable can be put in the header.tpl.....wont have time to check properly until next week though.

  10. #10
    Join Date
    Aug 2007
    Location
    Canada
    Posts
    19

    Default

    Geez, sorry. I just don't understand. I looked at view_video.tpl and simply don't understand what I need to edit. When you get a chance, please provide more direction.

    I appreciate your help. :)

    Vito

Similar Threads

  1. Add a truly random video to any page...
    By SportsGamingTV.com in forum Template Modifications
    Replies: 20
    Last Post: 04-25-2013, 12:01 PM
  2. how can i add users online script 2 header.tpl (smarty error
    By Spaniard7886 in forum Template Modifications
    Replies: 2
    Last Post: 07-11-2008, 11:53 PM
  3. Random Video Image
    By KnoPPerS in forum Template Modifications
    Replies: 1
    Last Post: 05-01-2008, 01:58 PM
  4. Carousel Random Viewer - OUT NOW!!
    By galnet in forum Template Modifications
    Replies: 23
    Last Post: 11-29-2007, 02:06 AM
  5. Image Hosting script
    By pierref in forum Sales Questions
    Replies: 1
    Last Post: 06-15-2007, 05:31 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •