Results 1 to 4 of 4
  1. #1
    ABW Ambassador Doug247's Avatar
    Join Date
    January 18th, 2005
    Location
    DE USA
    Posts
    931
    Ok I finally got a script to work on my site. Yeah...You'd think I'd be happy. Well I am but Now the next step. I am using a PHP script to display products but the script uses <? print $display_block; ?> to display the results.

    This might be a dubm question but here goes. Is there a way to have the entire contents of a page in the <? print $display_block; ?>?? Like the navigation, footer, and other stuff. If so how? Is there a tutorial?

    Currently the script part sits in a mostly HTML file event though it is called a PHP file.

    Thanks,

    Doug
    Thanks,
    Doug

  2. #2
    ABW Ambassador Doug247's Avatar
    Join Date
    January 18th, 2005
    Location
    DE USA
    Posts
    931
    I also want to be able to have the page title display the product title like <title>$widgets</title>

    Thanks,
    Doug
    Thanks,
    Doug

  3. #3
    Full Member
    Join Date
    January 18th, 2005
    Posts
    379
    You could just try this
    <?
    ..your magic php code to get data goes here....

    ?>
    <head>
    <?print "<title>$widgets</title>";?>
    </head>
    <body>
    <?include 'navigation.php';?>

    some html
    <?print "I love <b>$widgets</b>";?>

    more html...

    <?include 'footer.php';>
    </body>

  4. #4
    Just Lurking
    Join Date
    January 18th, 2005
    Posts
    1,263
    Some basic template code.

    <pre class="ip-ubbcode-code-pre">&lt;title&gt;
    &lt;?php
    if(@$header_title){
    echo $header_title;
    } else { ?&gt;
    My Company Name
    &lt;?php } ?&gt;
    &lt;/title&gt;</pre>

    Notice the @ sign? If $header_title doesn't exist the @ sign will suppress the error message and TITLE will be "My Company Name" as a default.

    Now there a lot of ways you could use this little template.

    You could name this template title.php and simply use include like this:

    <pre class="ip-ubbcode-code-pre">&lt;?php
    // do some data process
    $header_title = 'Widget.com - blue widgets';
    // then display some data
    include 'title.php';
    ?&gt;</pre>


    Or you could gather the page together using file_get_contents() and save all the pieces to a single executable php file using file_put_contents(). Remember every include opens and closes a file saving all those to a single file speeds things up. Basically the ouput would look something like the example above.

    Or maybe you just want to save the output of the php file. You'll need to get an output buffer going.

    <pre class="ip-ubbcode-code-pre">&lt;?php
    ob_start();

    // do some data process
    $header_title = 'Widget.com - blue widgets';
    // then display some data
    include 'title.php';

    $page = ob_get_contents();

    file_put_contents('blue_widget.php', $page);

    ob_clean();
    ?&gt;</pre>

    This might be what your trying to do if your using a datafeed. You don't really want the PHP you want the HTML output.

    Just going to post this and hope it helps.
    Lead, Follow or Get Out of the Way!

  5. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. PHP question - include(file.php) with variables
    By teezone in forum Programming / Datafeeds / Tools
    Replies: 8
    Last Post: September 4th, 2009, 04:54 PM
  2. php question
    By gearupandplay in forum PopShops
    Replies: 7
    Last Post: May 22nd, 2008, 08:45 PM
  3. Can someone help with this PHP question.
    By Derrick Kinsey in forum Programming / Datafeeds / Tools
    Replies: 4
    Last Post: March 22nd, 2007, 07:23 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
  •