Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: dynamic

  1. #1
    New to the CF scene
    Join Date
    Jun 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    dynamic

    im making my new site dymnamic, i made the content dymnaic but to make the title image diff. for each page im using some modded code:

    Code:
       <?php
       if (! file_exists("images/v2/title_$page.jpg"))
       {
       include("<img width='548' height='50' src='images/v2/title_update.jpg'>");
       }
       else
       {
       include("<img width='548' height='50' src='images/v2/title_$page.jpg'>");
       }
       ?>
    but when i load the page i get:

    Code:
    Warning: main(SHOWS THE IMAGE): failed to open stream: No such file or directory in /home/andy89/public_html/test/v2/v2.php on line 54
    
    Warning: main(SHOWS THE IMAGE): failed to open stream: No such file or directory in /home/andy89/public_html/test/v2/v2.php on line 54
    
    Warning: main(): Failed opening '<img width='548' height='50' src='images/v2/title_update.jpg'>' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/andy89/public_html/test/v2/v2.php on line 54
    any help will be good, thanks

    edit: site is http://www.andy89.com/test/v2/v2.php? for the default and http://www.andy89.com/test/v2/v2.php?page=news for the news page

  • #2
    Regular Coder
    Join Date
    Jun 2005
    Posts
    804
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Instead of using include(), which is meant for files, you should use echo. That'll send your tags directly to the browser:

    PHP Code:
      <?php
       
    if (! file_exists("images/v2/title_$page.jpg"))
       {
       echo(
    "<img width='548' height='50' src='images/v2/title_update.jpg'>");
       }
       else
       {
       echo(
    "<img width='548' height='50' src='images/v2/title_$page.jpg'>");
       }
       
    ?>


  •  

    Posting Permissions

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