Jump to content

Implode...


Lee-Bartlett

Recommended Posts

well...what is it doing (or not doing) and how does that differ from what you expect?

 

Your code will read all the lines from footer.php and output them. No PHP code will be processed. If you want the PHP code to be processed, try this:

 

  </tr>
  <tr>
    <td height="20" colspan="2" bgcolor="#0099FF"><?php include("includes/footer.php"); ?></td>
  </tr>
</table>

Link to comment
Share on other sites

Oh sorry, its not showing anything in the bottom table. My uncle sites uses it for code wrapping round templates, he told me to look at smarty templates to, but this is bit of his code he uses.

 

$sql = "select * from member where id='$ID'";
$res = mysql_query($sql);
$cnt = mysql_num_rows($res);
$data = @MYSQL_FETCH_ARRAY($res);

$page1 = implode("", file("../templ/members/header.htt"));
$page2 = implode("", file("../templ/footer.htt"));
$pagads = implode("", file("../templ/ads.htt"));

Link to comment
Share on other sites

This is all the php code in my uncles file, he wants me to replicate this, but on a more basic level.

 

session_start();
$UID = $_SESSION['UID'];
//$propid = $id;

if(!$UID)
   {
   $page = implode("", file("../templ/error.htt"));
   if($rdr1 == 1)
      $page = ereg_replace('ddd.com', "dd.com", $page);
   $msg = "Please <a href=\"login.php\">Login Here</a><br><br>";
   $msg .= 'Not a member yet? <a href="register.php">Register</a> in 30 seconds and list your property!';
   $page = ereg_replace('{MESSAGE}', $msg, $page);
   echo $page;
   exit();
   }

$sql = "select * from member where id='$UID'";
$res = mysql_query($sql);
$cnt = mysql_num_rows($res);
$data = @MYSQL_FETCH_ARRAY($res);

$page1 = implode("", file("../templ/members/header.htt"));
$page2 = implode("", file("../templ/footer.htt"));
$pagads = implode("", file("../templ/ads.htt"));

$title = "Rentals: Edit profile";
$page1 = ereg_replace('{TITLE}', $title, $page1);
$ADM = $_SESSION['ADMIN'];
if($ADM == "yes")
   {
   $page1 = ereg_replace('{ADS}', "<p>", $page1);
   $page1 = preg_replace("/<!-- ADMIN(.*?)-->/s", "$1", $page1);
   }
else
   $page1 = ereg_replace('{ADS}', $pagads, $page1);
if($rdr1 == 1)
  $page1 = ereg_replace('ddd.com', "dd.com", $page1);

$page1 = preg_replace("/<!-- PROPERTY -->(.*?)<!-- PROPERTY2 -->/s", "", $page1);
$page1 = preg_replace("/<!-- 3 -->(.*?)<!-- 3 -->/", "", $page1);
echo $page1;

Link to comment
Share on other sites

i can understand the use of file/implode for the sole reason the poster described:

Oh sorry, its not showing anything in the bottom table. My uncle sites uses it for code wrapping round templates, he told me to look at smarty templates to, but this is bit of his code he uses.

that way you can have your templates more readable with new lines, but when they are loaded, the new lines are stripped out.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.