Jump to content

perk3c251

Members
  • Posts

    9
  • Joined

  • Last visited

perk3c251's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Nevermind, I figured it out. I used $s.=$string, just forgot to add it to global.You guys absolutely rock. I would have never figured that one out on my own. Thanks again very very much.
  2. Ok, but I am a bit confused on how to use that. Do I have to define $filename? Would I call the function using $s.=get_include_contents($filename) or $s.=$string ?
  3. Here is leftside ads <table bgcolor=#6E7382 border=0 cellpadding=3 cellspacing=0><tr><td><?include 'ad1.php';?></td></tr><tr><td><?include 'ad2.php';?></td></tr><tr><td><?include 'ad3.php';?></td></tr><tr><td><?include 'ad4.php';?></td></tr><tr><td><?include 'ad19.php';?></td></tr><tr><td><?include 'ad20.php';?></td></tr></table> Here is ad1. They are all identical, just query different fields. <?include './ads/config.php';include './ads/opendb.php';$query = "SELECT ad1 FROM ads";$result = mysql_query($query);while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ echo "{$row['ad1']}" ; } print mysql_error();include './ads/closedb.php';?> I know this is probably the worst coding ever seen, but I only starting writing php and sql queries about 3 days ago, so dont bash me too hard. I think I would rather not change the include file though.
  4. function templateMain($userMenuStr,$adminMenuStr,$userStatus, $navBarText,$infoText,$gorumcontent,$footer){ global $leftads; global $xi; $s=""; $s.="<center>"; $s.="<table border='1' cellpadding='0' cellspacing='0'". " width='100%'>"; $s.="<tr><td colspan='3'>". "<img src='$xi/b.gif' height='20'></td></tr>"; $s.="<tr>"; $s.="<td width='10%'>";//left side ads[b]$s.=include('ads/leftsideads.php');[/b] <-------------------------------------------Here is where I am trying to insert the include $s.="</td>";//left $s.="<td valign='top' align='center' width='80%'>"; $s.="<table border='0' cellpadding='0' cellspacing='0'>"; $s.="<tr><td><img src='$xi/headpic.gif' width='705' height='61'>"; $s.="</td></tr>"; $s.="<tr><td align='center'><h3>Proudly serving the men"; $s.=" and women in Camp Victory, Iraq"; $s.="</td></tr></table>\n"; $s.=vertSpacer(); $s.="<span class='userstatus'>$userStatus</span>\n"; $s.=vertSpacer("3"); $s.=$userMenuStr;//lot of code return $s;} What ends up displaying is a 1 showing that it did execute the include, but I think it is executing it as soon as it reaches that part, instead of waiting until $s. is returned. The file does get displayed just on top of the table instead of inside that cell.
  5. I am trying to include a file in the middle of a function. I am trying to mod a piece of Noahs Classifieds. The functions writes everything to the variable $s. . The problem I am having is when I include the file, it executes as soon as it reads it, and then the function returns $s. . I need a way to include the file in the function. I thought about writing another function that has the include in it, but only calling it from the first function. Would that even work? Tried using fopen, get_file_contents etc, but the file I am trying to include also has include statements and they end up not being read.
  6. That gave me the same result.I need something like this $s.=include('filepath'); I have tried many variations of the code, putting the quotes in different places, etc. Any other ideas?
  7. Can I use a variable to store an include statement? If so what is the right syntax for it? Everything I have tried just calls the include and pretty much ignores the variable.
  8. perk3c251

    Help please

    Thanks Mr_CHISOL,I couldn't get it to work quite right with your code, but it gave me the info I needed. Not sure if this is the right way to do it, but I ended up using this <? switch ($_GET["section"]) { case "": include("./home.html"); break; case "a": include("./a.html"); break; case "b": include("./b.html"); break;}?> Your advice on how to link to the pages really helped.Thanks again.
  9. perk3c251

    Help please

    Hi, I am very new to php and mySQL. I have a site setup with a header, leftside, middle, rightside, and footer. My problem is, I want to be able to call different pages and display them in the middle section, but have everything else stay the same.My index.php is setup to include the various sections, and I am able to display 1 page in the middle.Sorry if I didn't explain this very well.
×
×
  • Create New...