Results 1 to 4 of 4

Thread: Passing variable to page.php?

  1. #1
    Join Date
    Feb 2007
    Posts
    51

    Unhappy Passing variable to page.php?

    This is a follow up to my earlier post, http://nicecoder.com/community/showthread.php?t=5829.

    Now I would like to call a custom page with a variable, sort of like: http://www.domain.com/page.php?id=pa...pecial_id=1840

    I´m trying to do this with a custom block adding "special_id" as a parameter in the block <%block_myblock special_id="$special_id" max_item="1"%>.

    But I only end up with a blank page. Well, not really blank as I get the rest of the template, but not the block information. I tried the SQL from the block-code in the query window in admin and that works.

    Please help...

  2. #2
    Join Date
    Nov 2004
    Posts
    1,822

    Default

    Hmm, as a guess i would say you need to change page.php slightly, include this :

    $special_id = $_request[special_id];

    and then change line 29 to this :
    DisplayTemplate($theme_path . $id . '.html', "\$special_id");

    the changes to page.php will be similar to this :
    Code:
     $bad_templates = array('\.\.', 'http://', 'https://', 'file://', 'php://');
      if (!ereg(implode('|', $bad_templates), $id) && file_exists($theme_path . $id . '.html')) {
    $special_id = $_request[special_id];
        DisplayTemplate($theme_path . $id . '.html', "\$special_id");
      }
    place the code <%$special_id%> into the template to test it, as soon as a number appears then your block code will work, its jsut a case of making sure the variable is moved to your page correctly.
    Main IndexU sites : | Campsite Directory | Tourist Guide | Places2B | AfterDirectory <-- Half price submission using coupon DP50 (from just $11 premium, and $10 basic permanent )

  3. #3
    Join Date
    Feb 2007
    Posts
    51

    Default

    Working! Thanks a lot. My site is getting better and better with your superb help.
    /Martin

  4. #4
    Join Date
    Nov 2004
    Posts
    1,822

    Default

    glad it worked
    Main IndexU sites : | Campsite Directory | Tourist Guide | Places2B | AfterDirectory <-- Half price submission using coupon DP50 (from just $11 premium, and $10 basic permanent )

Similar Threads

  1. Passing %link_id% to php-script
    By pimpmaster in forum v5.x
    Replies: 12
    Last Post: 12-16-2007, 06:18 PM
  2. Create variable to use in HTML
    By michaer in forum v5.x
    Replies: 1
    Last Post: 02-28-2007, 12:03 AM
  3. php affiliate code not passing
    By vittle in forum v5.x
    Replies: 1
    Last Post: 02-16-2006, 05:52 PM
  4. Replies: 3
    Last Post: 09-21-2005, 04:28 AM

Posting Permissions

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