Jump to content


Change include PHP


3 replies to this topic

#1 ^xEnigmA>

    Young Padawan

  • Members
  • Pip
  • 4 posts

Posted 30 May 2005 - 02:14 PM

sorry just found out how on an old post, now ive got a new question how do i not show part of a page in an include rite

this is the php code on one of my pages home.php which shows the last piece of news

<?php include 'news.php'; echo "$rnews"  ?>

then on my news.php this is the code:

<?php

$rnews = 'The Last piece of news';
$news = ' All the rest of the news';

echo "$rnews <br> $news"

?>

on the home.php page how can i make this part not appear?

echo "$rnews <br> $news"


#2 fiv3isaliv3

    Young Padawan

  • Members
  • Pip
  • 258 posts
  • Gender:Male

Posted 30 May 2005 - 03:15 PM

as far as i know you can't limit what an include includes. just put what you want to appear in a seperate page and what you don't want in another page and use some if statements to display one page when certain conditions are met and the other page when other conditions are met.

#3 ^xEnigmA>

    Young Padawan

  • Members
  • Pip
  • 4 posts

Posted 30 May 2005 - 03:20 PM

ok... slightly confused, im quite new to using php so are you saying there is no way of doing this or you dont know how to do this?

#4 fiv3isaliv3

    Young Padawan

  • Members
  • Pip
  • 258 posts
  • Gender:Male

Posted 30 May 2005 - 04:18 PM

no i said as far as i know you can't limit what is included in a page include. i then went on to farther say to do this:

page one = what you want to appear
page two = what you don't want to appear on page one but might want to appear on another page

if conditon met to display page one, display page one
else
if condition not met to display page one, display page two.

so your code would end up looking something like this.

if ($page == $yourcondition){
require "pageone.php";
}
else{
require "pagetwo.php";
}

of course there are variables you'll need to define and so on but this should give you the basic idea.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users