Page 1 of 2

Download it and work it out..! If you can..!

Posted: Wed Oct 30, 2002 4:18 pm
by Darkside
Tis not a job for a noob.. Dont think you could work this 1 out.

http://www.no-order.co.uk/php/php-links.zip

http://www.no-order.co.uk/php/

If some1 could download this and work it out for me I would be most greatful.

Posted: Wed Oct 30, 2002 4:25 pm
by volka
1) this is not http://www.write-me-a-script.net ;)
2) broken link
3) if you want to hire someone there's a 'Job hunt' board, otherwise try it yourself and ask your questions

despite that: welcome :D

Posted: Wed Oct 30, 2002 4:36 pm
by Darkside
Bla ok.. then Mr.Guru..

If I had a 4 Pages..

Index.php
Menu.php
News1.php
News2.php


And I have in the index.php

<?php include ("menu.php");?>
and
<?php include ("$page.php");?>

With this code before it..

?>

$page = trim($page);
if (empty($page)) {
$page = "news1";
}

?>

Then in the menu.php I have a 2 links.. index?page=news1 and index?page=news2

Why does it not load news2.php when I click mez link?

Posted: Wed Oct 30, 2002 4:40 pm
by Darkside
I'm v.sry I'm a real newbie and I just dont understand why it doesnt work.. and I dont get any errors so I dont really know how to explain the problem (lack of know wot it is) so..


Been racking my brain on this all day and I stopping from making th rest of my site if you have any clues in wotz up pls help a lad out..

Posted: Wed Oct 30, 2002 4:43 pm
by volka
what does

Code: Select all

&lt;?php phpinfo(); ?&gt;
tell you about your version?
Sticky: Before Post Read: Concerning Passing Variables in PHP 4.2+

BLA..!

Posted: Wed Oct 30, 2002 4:47 pm
by Darkside
PHP Version 4.2.1

System Linux lion.zooyard.co.uk 2.4.13 #1 Sun Feb 24 22:52:49 EST 2002 i586 unknown
Build Date Aug 2 2002 21:03:36
Configure Command './configure' '--prefix=/usr/local' '--with-apache=/fileserver/toolbox/Apachetoolbox-1.5.58/apache_1.3.26' '--enable-exif' '--enable-track-vars' '--with-calendar=shared' '--enable-magic-quotes' '--enable-trans-sid' '--enable-wddx' '--enable-ftp' '--enable-inline-optimization' '--enable-memory-limit' '--with-imap=/usr/local' '--with-mhash=/usr/local' '--with-mcrypt=/usr/local' '--with-openssl=/usr/local' '--with-gettext=/usr' '--with-mysql=/usr' '--with-pgsql'
Server API Apache
Virtual Directory Support disabled
Configuration File (php.ini) Path /usr/local/lib/php.ini
Debug Build no
Thread Safety disabled

Posted: Wed Oct 30, 2002 4:51 pm
by volka

Posted: Wed Oct 30, 2002 4:55 pm
by infolock
Darkside: Umm, dude, I don't see anywhere in there that you are calling a news2.php file. The only thing I see in there that is causing your page 2 to load up, however, is this piece of code:

Code: Select all

if (empty($page)) 
&#123;
	$page = "page2";
&#125;
I think you are screwing up somewhere in your code, but you are using values that I'm not too familiar with, such as trim and if (empty($page))

again, I think there is something else going on here.... but, since this obviously isn't the full source, no way to tell.

So, try this: Post your question a little bit more clearly. No offense intended man, but we can't read your mind and try to figure out what the deal is without a more clear explanation of what you are wanting to do, what happens, and what was expected......

Posted: Wed Oct 30, 2002 5:16 pm
by Darkside
Here goes again..

Wot I want is a set layout on my page and when I click a link change the main area of text.. eg a php frame set..

So I have a menu.php and I have a banner.php and a news.php

So wot ive done is made a new files called index.php and included all the php files where I want them in a table.. Banner at the top menu at the left side and the news. in the Main area.

eg.. http://www.no-order.co.uk/mainframe/

So the way I went about this was to..

have this:

//Not knowing excectly wot its does (me being a noob)
$page = trim($page);
if (empty($page)) {
$page = "news";
}

seting $page to news

and then where I would have

<?php include ("news.php") ; ?>

I put

<?php include ("$page.php") ; ?>

Right now this is where that "trim" come into it..

On my menu.php on my links I add index.php?page=news2

hoping that when the page reload it would have changed $page to
news there fore changing

<?php include ("$page.php") ; ?>

//would infect be..

<?php include ("news2.php") ; ?>

and news.php would not be there and the news2.php would be there

How ever this does not work.

I do hope you sort of understand a bit more wot I trying to do.. So when I click and link it change my <?php include ("page.php") ; ?> to something esle..

Thanks at lot your real guru's

Posted: Wed Oct 30, 2002 5:36 pm
by Darkside
<?
if($id=="1") include("Something.php");
ifelse($id=="2") include("Something2.php");
else header("Location: Main.php?id=1");
?>


Found this could I work this with this?

Posted: Wed Oct 30, 2002 10:16 pm
by volka
I'm pointing you one last time to viewtopic.php?t=511 ;)

your href="index.php?page=news2" approach can work if you note how those parameters are stored by default in php 4.2 and newer

additional note: index.php?page=news2 means page=news2 is passed via GET-method to script index.php

Posted: Thu Oct 31, 2002 5:05 am
by Darkside
I'm looking but I really am confused..

Posted: Thu Oct 31, 2002 5:14 am
by Darkside
eg.. please could you tell me what I need to do then..

I need to define the index.php?page=news some where ?

Make a post form? I really am confused..

Posted: Thu Oct 31, 2002 5:17 am
by twigletmac
You can't just access the page variable from the query string as $page, you have to use the $_GET array, try $_GET['page'] instead of $page.

Mac

Posted: Thu Oct 31, 2002 5:19 am
by Darkside
Wot are you saying.. I need to add

<?php
echo $_POST['index.php?page=news'];
?>

:?: :?:

bla.. I'm crying now.. :roll: