SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast oneafrikan's Avatar
    Join Date
    Oct 1999
    Location
    London, Uk
    Posts
    78
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    please help me.... im completely stumped!!!! ;-)

    hey there boys and girls

    I'm really in a fix regarding the use of includes, both to make layout changes easily and using them as headers and footers, but more importantly, to add them to dynamic content.

    OK, when I create the page layout, put the necessary code into the headers and footers, and then use the headers and footers, in a page where they are called like so:

    PHP Code:
    <? php
    include header here ?>
    some content here
    <? php
    include footer here ?>
    now, when I have used static text, this is fine, and works really well - everything is parsed as in the layout I did.

    But when I am using dynamic scripts, which calls stuff out of a database, the html code is parsed, but the dynamic stuf isn't - the dynamic stuff includes a call to an add script (phpAdsNew), a poll script (sympoll), and a news script calling news from the database (ssnews done by skunk).

    Basically the output of the dynamic php appears to be blank:

    I get the following from the banner code:

    <!-- add banner code here -->
    <div id="banner">
    </div>

    and the same for the poll code:

    <!-- poll here -->
    <div id="poll">
    <div><img src="../img/pspot_header.gif" width="160" height="20" alt="Cast your vote!" border="0"></div>
    <div id="pollbkg">
    Unable to select database


    except, that here the poll database is not selected....

    So, it seems to me that either I am doing something wrong in the code itself, ie, using a php include (the call to the poll) in the include file itself (which would be the header/footer files), or there is a setup/config problem I am unaware of.

    Anyway - this is really frustrating , 'cos I cant really progress with the site until I get this done. I can do the static content, but my site will not be able to display dynamic content.

    Please - somebody tell me they've encountered the same problem, and I'm a dumbass , so I can sort this out, and hopefully get going....
    -> www.oneafrikan.com ><-><><-><-><-><-><
    -> www.openboxsoftware.com ><><-><-><-><

  2. #2
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    are you wrapping the dynamic bits in <?php ?> tags?

    I think I use a similar system to what you describe, but haven't had any problems!
    I swear to drunk I'm not God.
    » Matt's debating is not a crime «
    Hint: Don't buy a stupid dwarf ö Clicky

  3. #3
    SitePoint Enthusiast oneafrikan's Avatar
    Join Date
    Oct 1999
    Location
    London, Uk
    Posts
    78
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    hey weirdbeardmt

    Hey,

    thanks for the reply ;-)

    Yes, I am wrapping the includes in php.... - it seems that there is only a problem when the includes are inside another include file...

    so thats why I'm so stumped - it works with static text, but when there is dynamic stuff, it seems to go haywire...

    any other ideas??

    thanks
    gareth
    -> www.oneafrikan.com ><-><><-><-><-><-><
    -> www.openboxsoftware.com ><><-><-><-><

  4. #4
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    post the entire script, as it'll reveal if you have errors in your sql queries or not.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  5. #5
    SitePoint Enthusiast oneafrikan's Avatar
    Join Date
    Oct 1999
    Location
    London, Uk
    Posts
    78
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Hi Defender1

    OK, here goes:

    here is the header:
    /////////////////////////////////////////
    PHP Code:
    <?php
     
    include('../inc/global_functions.php');
     
    ?>

    -->this file has the following in it:

    <?php
    // Auto-Meta v1.4.20 By Ryan Hunt (Nayr of Nayr Productions)
        
    function mt_description() {  
            print   
    "<META name=\"description\" content=\""
            
    $read_des readfile"../inc/description.txt"); 
            print   
    "\">"
      }
      
      function 
    mt_keywords() { 
            print   
    "<META name=\"keywords\" content=\""
            
    $read_key readfile"../inc/keywords.txt"); 
            print  
    "\">";      
      }
      
      
    //footer text
    function footer_text() { 
            print   
    "&nbsp;"
            
    $read_foot readfile"../inc/lc_footertext.txt"); 
            print  
    "&nbsp;";      
      }
      
    function 
    navmenu() { 
            
    $read_nav readfile"../inc/lc_navmenu.htm"); 
      }
    function 
    submenu_about() { 
            
    $read_submenu_about readfile"../about/submenu_about.php"); 
      }
    ?>

    carry on:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html><head><title> &lt; Dragflick.com &gt; Worldwide Fieldhockey Xchange <?php echo $title?></title>
    <!-- meta tags -->
    <META http-equiv=Content-Type content="text/html; charset=windows-1252">
    <META content="Team Dragflick.com (webmaster@dragflick.com)" name=Author>
    <META content="MSHTML 5.50.4134.600" name=GENERATOR>
    <?php
        mt_description
    ();         
        
    mt_keywords(); 
    ?>
    <META content=ZA name=country>
    <META content=webmaster@dragflick.com name=organization-Email>
    <META content="copyright 2001 - Dragflick.com" name=copyright>
    <META content=Worldwide name=coverage>
    <META content=September2001 name="creation date">
    <META content=20days name=revisit_after>
    <META content=" &lt; Dragflick.com &gt; Worldwide Fieldhockey Xchange _______________________Ver 2.0" name=title>
    <META content=http://www.dragflick.com/ name=identifier>
    <META content=English name=language>
    <META content=follow name=robots>
    <!-- stylesheets-->
    <link rel="STYLESHEET" type="text/css" href="../css/global_test1.css">
    <link rel="STYLESHEET" type="text/css" href="../css/layout_test1.css">
    <!-- js -->
    <script language="javascript" type="text/javascript" src="../script/chromeless_31.js"></script><!-- thanks to Gabriel and public domain for the chromeless windoze -->
    <script language="javascript" type="text/javascript" src="../script/ypSlideOutMenusC.js"></script><!-- thanks to Aaron at youngpup.net again!-->
    <SCRIPT language=javascript type="text/javascript" src="../script/global.js"></SCRIPT><!--global js functions-->
    <link rel="shortcut icon" href="../favicon.ico">
    </head>
    <body onLoad="MM_preloadImages('../img/quit.gif','../img/info_over.gif','../img/submit_over.gif');window.defaultStatus='< Dragflick.com >'">

    <table align="left"border="0" cellpadding="0" cellspacing="0">
    <tr><!-- topline-->
    <td width="5" height="3"><img src="../img/topleft_cnr.gif" width="5" height="3" border="0"></td>
    <td height="3" class="topline" colspan="2" align="center""><img src="../img/spacer_5h.gif" width="10" height="3" border="0"></td>
    <td width="7" height="3"><img src="../img/topright_cnr.gif" width="7" height="3" border="0"></td>
    </tr>

    <tr bgcolor="#99CCFF"><!-- logo line -->
    <td width="5"><img src="../img/left_logo.gif" width="5" height="73" border="0"></td>
    <td colspan="2">
    <div id="logo"><img src="../img/logo.gif" width="129" height="73" alt="Welcome to Dragflick.com, the worldwide Fieldhockey Xchange" border="0"></div>
    <div id="lcd"><img src="../img/lcd_sc.gif" width="147" height="62" alt="Dragflick.com launches Fieldhockey Xchange" border="0"></div>
    <div id="rightspacer"><img src="../img/rightside_banner2.gif" width="6" height="73" border="0"></div>
    <!-- add banner code here -->
    <div id="banner">
    <?php 
    require('../ads/phpadsnew.inc.php');
    view("468x60"0"""_blank");
    ?>
    </div>
    <div id="menubar"><!-- add navmenu code here -->
    <?php navmenu(); ?></div>
    </td>
    <td width="7" class="rightside_banner"><img src="../img/rightside_banner.gif" width="7" height="1" border="0"></td>
    </tr>

    <tr><!-- bottom_logo line -->
    <td width="5" height="6"><img src="../img/bottomleft_cnr.gif" width="5" height="6" border="0""></td>
    <td height="6" class="bottomline" colspan="2"><img src="../img/spacer_5h.gif" width="10" height="5" border="0"></td>
    <td width="7" height="6"><img src="../img/bottomright_cnr.gif" width="7" height="6" border="0"></td>
    </tr>

    <!-- all the content /////////////////////////////////////////////////////////////-->
    <tr valign="top">
    <td width="5" class="leftside">&nbsp;</td><!-- left side of the table -->



    <td><!-- this is where the content goes-->
    <!-- news header here //////////////////////////////////////////////////////////////-->
    <table width=98% border=0 cellspacing=1 cellpadding=3 align="center">
    <tr>
    <td class="header">&nbsp;Team Dragflick.com News</td>
    <td align=right><div class="submenu">
    <b>&middot;</b> <a href="news.php">News</a>&nbsp;<b>&middot;</b> <a href="users.php?action=login">Log In</a>&nbsp;<b>&middot;</b> <a href="news.php?action=search">Search News</a>&nbsp;<b>&middot;</b> <a href="news.php?action=archive">News Archive</a>&nbsp;</td>
    </div></td>
    </tr>
    <tr>
    <td colspan=2 valign=top>

    and here is the footer:
    ////////////////////////////////////////////////
    PHP Code:
    </td>
    <tr>
    <td colspan=2 align=right><div class="submenu">
    <a href="news.php">News</a> | <a href="news.php?action=archive">Archive</a> | <a href="news.php?action=search">Search News</a> | <a href="news.php?action=login">Login</a> | <a href="users.php">Staff</a> | Powered by <a href="http://www.sslinks.co.uk/" target="_blank">ssNews v1.0</a>
    </div></td>
    </table>

    </td>
    <td width="170"><!-- this is where the team section goes - team, competition, polls -->
    <div class="section_wrapper">
    <!------------- team --------------->
    <!--section header image-->
    <div class="section_header""><img src="../img/hdr_team.gif" width="164" height="20" alt="Join the Dragflick Team Worldwide" border="0"></div>

    <!--section wrapper-->
    <div style="background-image: url(../img/bkg_block.gif)">

    <!--Team dragflick -->
    <div id="subsection_header"><img src="../img/join_team.gif" width="164" height="10" alt="Join team Dragflick.com" border="0"></div>

    <!--Team dragflick links to features-->
    <div class="subsection_text"">
    <img src="../img/arrow.gif" width="10" height="5" alt="" border="0">
    <!--warmup --><a href="javascript:;" onclick="warmup=openIT('../members/warmup.htm',400,400,null,null,'warmup');" onMouseOver="MM_displayStatusMsg('&lt; Dragflick.com &gt; warmup');return document.MM_returnValue">Do the warmup</a><br>
    <img src="../img/arrow.gif" width="10" height="5" alt="" border="0">
    <!-- member signup --><a href="../members/index.php" onMouseOver="MM_displayStatusMsg('&lt; Dragflick.com &gt; member signup');return document.MM_returnValue">Become a member</a><br>
    <img src="../img/arrow.gif" width="10" height="5" alt="" border="0">
    <!-- calendar --><a href="../forum/calendar.php" target="_blank" onMouseOver="MM_displayStatusMsg('&lt; Dragflick.com &gt; Calendar');return document.MM_returnValue">View the calendar</a><br>
    <img src="../img/arrow.gif" width="10" height="5" alt="" border="0">
    <!-- about calendar --><a href="javascript:;" onClick="aboutcalendar=openIT('../members/about_calendar.htm',400,400,null,null,'aboutcalendar');" onMouseOver="MM_displayStatusMsg('&lt; Dragflick.com &gt; about the calendar');return document.MM_returnValue">More about the calendar</a>
    </div>

    <!-- newsletter section -->
    <div id="subsection_header"><img src="../img/newsletter.gif" width="164" height="10" alt="Subscribe to the Dragflick.com newsletter" border="0"></div>
    <div class="subsection_text">
    <!-- newsletter form -->
    <table height="40" width="100%"><form action="../cgi_bin/lists/news.cgi" name="newsletter" method="post">
    <tr><td><INPUT type=text alt="your e-mail" value=" enter your email" name="address" onblur="if(this.value=='')this.value=' enter your email';" onfocus="if(this.value==' enter your email')this.value='';" class="email"></td></tr>
    <tr><td><IMG border=0 name=update src="../img/join.gif">&nbsp;<input class="radio" checked type=radio name=action value=subscribe onclick="document.images['update'].src = '../img/join.gif';" hidefocus><input class="radio" type=radio name=action value=remove onclick="document.images['update'].src = '../img/quit.gif';">&nbsp;&nbsp;<INPUT alt=send border=0 height=12 width=40 src="../img/submit.gif" type="image" name="Submit" value="Update" hidefocus onMouseOver="MM_swapImage('Submit','','../img/submit_over.gif',1)" onMouseOut="MM_swapImgRestore()"></td></tr>
    </form></table>
    <!-- more info on newsletter -->
    <span style="float: right"><img src="../img/more.gif" width="38" height="10" alt="" border="0">&nbsp;&nbsp;<A href="javascript:;" onclick="hear=openIT('../info/info_newsletter.html',400,300,null,null,'hear');" onMouseOver="MM_displayStatusMsg('&lt; Dragflick.com &gt; find out more about the newsletter');return document.MM_returnValue"><img src="../img/info.gif" width="27" height="12" alt="Find out more about the newsletter" border="0" name="newsletterinfo" onMouseOver="MM_swapImage('newsletterinfo','','../img/info_over.gif',1)" onMouseOut="MM_swapImgRestore()"></A>&nbsp;&nbsp;&nbsp;&nbsp;</span>
    </div>

    <!-- spread da news -->
    <div id="subsection_header"><img src="../img/spread_news.gif" width="164" height="10" alt="Spread the news!" border="0"></div>
    <!-- more info on newsletter -->
    <div class="subsection_text">
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {

    var url="http://www.Dragflick.com";
    var title="<< Dragflick.com >> fieldhockey Xchange";

    document.write('<img src="../img/arrow.gif" width="10" height="5" alt="" border="0"><A HREF="javascript:window.ext');
    document.write('ernal.AddFavorite(url,title);" ');
    document.write('onMouseOver=" window.status=');
    document.write("'Bookmark Dragflick.com!'; return true ");
    document.write('"onMouseOut=" window.status=');
    document.write("' '; return true ");
    document.write('">Bookmark Dragflick.com!</a>');
    }
    else {
    var msg = "";
    if(navigator.appName == "Netscape") msg += "&nbsp;&nbsp;&nbsp;Bookmark Dragflick.com!";
    document.write(msg);
    }
    // End -->
    </script><br>
    <img src="../img/arrow.gif" width="10" height="5" alt="" border="0"><a href="javascript:;" onClick="mates=openIT('../cgi_bin/birdcast.cgi',400,400,null,null,'mates');" onMouseOver="MM_displayStatusMsg('&lt; Dragflick.com &gt; Tell yer mates');return document.MM_returnValue" title="Tell your mates about Dragflick.com">Tell yer mates!</a>
    </div>



    <!------------- comps --------------->
    <div class="subsection_header" style="background-image: url(../img/bkg_block.gif)"><img src="../img/comps.gif" width="164" height="10" alt="" border="0"></div>
    <div class="subsection_text">
    <img src="../img/arrow.gif" width="10" height="5" alt="" border="0">Competition 1<br>
    <img src="../img/arrow.gif" width="10" height="5" alt="" border="0">Competition 2<br>
    <img src="../img/arrow.gif" width="10" height="5" alt="" border="0">Competition 3<br>
    </div>




    <!------------- polls --------------->
    <!-- poll here -->
    <div id="poll">
    <div><img src="../img/pspot_header.gif" width="160" height="20" alt="Cast your vote!" border="0"></div>
    <div id="pollbkg">
    <?php require '/opt2/dragflic/httpd/htdocs/dragflick/polls/booth.php';
    display_booth(1); ?>
    </div>
    </div>




    </div><!------------- end content wrapper here --------------->
    </td>

    <td width="7" class="right_col">&nbsp;</td><!-- right side of the table -->
    </tr><!-- end the row and the right side -->

    <!-- footer //////////////////////////////////////////////////////////////////////////-->
    <tr align="left" valign="top">
    <td width="5" height="3"><img src="../img/footer_leftcnr_top.gif" width="5" height="3" border="0"></td>
    <td height="3" class="footer_top" colspan="2""><img src="../img/spacer_5h.gif" width="20" height="3" border="0"></td>
    <td width="7" height="3"><img src="../img/footer_rightcnr_top.gif" width="7" height="3" border="0"></td>
    </tr>
    <tr bgcolor="#99CCFF">
    <td width="5"><img src="../img/footer_leftside.gif" width="5" height="13" border="0"></td>
    <td colspan="2" align="center"><!-- include the footer text here --><?php footer_text();?></td>
    <td width="7"><img src="../img/footer_rightside.gif" width="7" height="13" border="0"></td>
    </tr>
    <!-- bottom footer line -->
    <tr align="left" valign="top">
    <td width="5" height="6"><img src="../img/footer_leftcnr_btm.gif" width="5" height="5" border="0"></td>
    <td height="5" class="footer_btm" colspan="2"><img src="../img/spacer_5h.gif" width="20" height="5" border="0"></td>
    <td width="7" height="6""><img src="../img/footer_rightcnr_btm.gif" width="7" height="5" border="0"></td>
    </tr>
    </table>
    </body>
    </html>

    the news.php file sits inbetween, and is the "engine" for the news articles...


    Now, firstly, goto:
    http://www.dragflick.com/index.php - for a look at the revised code....(ignore poll colours too ;-) - this should give you an idea of what the right section looks like.


    then, goto:


    http://www.dragflick.com/about/jobs.php - (ignore the colours for the poll - i had to reset it, cos i had some problems - wil redo soon...) this is static text, with php includes for the headers and footers.. and it works well, as you can see.

    ----------[as an aside - open this page in mozilla, and see if you can tell me what the crap I am doing wrong, to cause the right column to push over to the right like that.....]----------

    and compare the above page to:

    http://www.dragflick.com/news/news.php

    - I'm having major problems here - I've followed every tut, done all I think I should. On my local host, I get the following error "Unable to select database", and on the server, I get what u see...., as well as not having the banner display..., so it seems to me there is a problem with the code somewhere, but I cant find it, and without it I'm basically stuffed...

    ok - nuff for now, tell me what u think.. ;-)

    thanks
    gareth
    Last edited by oneafrikan; Oct 23, 2001 at 15:15.
    -> www.oneafrikan.com ><-><><-><-><-><-><
    -> www.openboxsoftware.com ><><-><-><-><

  6. #6
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    The first thing that appears in the code when I view news.php is the database error:
    Warning: Supplied argument is not a valid MySQL result resource in /opt2/dragflic/httpd/htdocs/dragflick/news/news.php on line 167
    Since that's the first error to occur in the page, it's the first error I would attempt to diagnose. Unfortunately, you didn't post the code of news.php so I can't do that.

    Email me the code at kevin@sitepoint.com and I'll take a look.
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference


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
  •