Results 1 to 10 of 14

Hybrid View

  1. #1

    Default Javascript on 1 Document General page only

    Ok, I have added a flash video player to my site using the "Document General" category. The player and playlists work great.

    The problem is that I had to add some javascript to the "tpl_document_general_info_display.php" page and now the buttons for my playlists show up on ALL of my Document General pages. Is there some code I can add to the php page to make the javascript only show on one specific page? Possibly by the "id"?

    Here is the working page:
    http://www.thebasher.com/index.php?m...products_id=33

    And here is a link (one of many) to a page that I don't want the javascript to load on but as of now it does:
    http://www.thebasher.com/index.php?m...products_id=35

    I placed the code in the tpl_document_general_info_display.php to show up on the bottom of the page.

    If anyone has a fix I would greatly appreciate it.

    Thanks!

  2. #2

    Default Re: Javascript on 1 Document General page only

    Anyone have a suggestion or fix?

  3. #3
    Join Date
    Sep 2004
    Posts
    1,388
    Plugin Contributions
    4

    Default Re: Javascript on 1 Document General page only

    Unfortunately, due to the way templates are generated, you don't have many options in the realm of non-hack workarounds.

    The simplest solution would be to wrap the inclusion of your flash player in an if statement. The contents of the if statement would be the products_id values that match each product where the player should be displayed. Based on your posts, here's an example that assumes you only have the player on one product:
    Code:
    if ($_GET['products_id'] == 33) {
      // include your javascript here
    }
    Frank Koehl
    "Cleverly Disguised as a Responsible Adult"

    frankkoehl.com

  4. #4

    Default Re: Javascript on 1 Document General page only

    Hey Blindside. Thanks for the reply. I figured that I would need to include and "if" statement. However, it didn't work. Here is a snippet of the code where I put the "if" statement. I am possibly, and most likely, doing it wrong.

    Nice blog. The "Do Search Stats Dictate Your Agenda?" post was excellent. I couldn't agree more!

    [CODE]<!--bof Additional Product Images -->
    <?php
    /**
    * display the products additional images
    */
    require($template->get_template_dir('/tpl_modules_additional_images.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_additional_images.php'); ?>
    <!--eof Additional Product Images -->


    if ($_GET['products_id'] == 33) {
    <p align="center">
    <button onclick="javascript:createplayer('http://www.thebasher.com/mediaplayer/playlist_featured.xml', true)">Featured
    Videos<br />
    <img src="http://www.thebasher.com/mediaplayer/basher_tv/playlist_images/featured_video.jpg" alt="Featured Videos" width="100" height="100" /></button>

  5. #5

    Default Re: Javascript on 1 Document General page only

    For some reason I am not able to include all of the code so I made an attachment instead.
    java code.txt

  6. #6
    Join Date
    Sep 2004
    Posts
    1,388
    Plugin Contributions
    4

    Default Re: Javascript on 1 Document General page only

    I can't tell from your post or your attachment exactly what your code looks like (the attachment is full of backslashes and hex code). However, I am guessing that you're not closing the php tags before outputting your html. Here's a clearer example:
    Code:
    <!--bof Additional Product Images -->
    <?php
    /**
    * display the products additional images
    */
    require($template->get_template_dir('/tpl_modules_additional_images.php',DIR_WS_TEMPLATE , $current_page_base,'templates'). '/tpl_modules_additional_images.php'); ?>
    <!--eof Additional Product Images -->
    
    if ($_GET['products_id'] == 33) {
    ?>
    <p align="center">
    <button onclick="javascript:createplayer('http://www.thebasher.com/mediaplayer/playlist_featured.xml', true)">Featured Videos<br />
    <img src="http://www.thebasher.com/mediaplayer/basher_tv/playlist_images/featured_video.jpg" alt="Featured Videos" width="100" height="100" /></button>
    <?php
    // continue with php code...
    ?>
    Note the stuff highlighted in red.

    Thanks for the blog kudos!
    Frank Koehl
    "Cleverly Disguised as a Responsible Adult"

    frankkoehl.com

 

 

Similar Threads

  1. Wheres the file??? Document general page shows blank.
    By ben harry in forum General Questions
    Replies: 5
    Last Post: 14 Aug 2013, 02:47 PM
  2. Document General
    By ttmb33 in forum Customization from the Admin
    Replies: 1
    Last Post: 3 Feb 2011, 03:32 PM
  3. Product general in document general
    By Akasashasha in forum General Questions
    Replies: 7
    Last Post: 5 Apr 2010, 04:15 AM
  4. Document General
    By Astarkley in forum General Questions
    Replies: 9
    Last Post: 1 Sep 2009, 09:56 PM

Posting Permissions

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