Jump to content
xisto Community
Sign in to follow this  
jailbox

Pages In 1 File ??

Recommended Posts

can you explain better ?

not really lol. Ill try. Lets say u make a simple flatfile guestbook. I did. I have separate files for signing, writing to txt file and viewing the guestbook. Now I wanna know if its possible that these 3 things are in 1 file

Share this post


Link to post
Share on other sites

Do you mean something like this?

<?php[br]if($_GET['show'] == "guestbook")[/br]{[br]	echo "guestbook";[/br]}[br]elseif($_GET['show'] == "info")[/br]{[br]	echo "info";[/br]}[br]else[/br]{[br]	echo '<a href="?show=guestbook"> guestbook </a><br>';[/br]	echo '<a href="?show=info"> info </a>';[br]}[/br]?>

Share this post


Link to post
Share on other sites

Do you mean something like this?

<?php[br]if($_GET['show'] == "guestbook")[/br]{[br]	echo "guestbook";[/br]}[br]elseif($_GET['show'] == "info")[/br]{[br]	echo "info";[/br]}[br]else[/br]{[br]	echo '<a href="?show=guestbook"> guestbook </a><br>';[/br]	echo '<a href="?show=info"> info </a>';[br]}[/br]?>
I dunno. Im not sure. I aint good with php

Share this post


Link to post
Share on other sites

what you are trying to accomplish could be possible with flatfiles,
although we can't help you with the technicalities of the code,
unless we actually see your code. maybe you can upload your
bare code in your site, and have us review it for alteration/
modification to the end you desire. :(

or better yet, start learning more PHP and MySQL to maximize the
features of Xisto hosting. :( i'm wary of using flatfiles since they
are not really that secure enough. at least that's what i think, since
they can essentially be called directly from the browser
(example: http://ww38.yoursite.com/flatfilename.txt). :( heheheü
anyway, a flatfile has its uses, but i won't use it if i want to make
some/all content in it secure.

Share this post


Link to post
Share on other sites

Do you mean something like this?

<?php[br]if($_GET['show'] == "guestbook")[/br]{[br]	echo "guestbook";[/br]}[br]elseif($_GET['show'] == "info")[/br]{[br]	echo "info";[/br]}[br]else[/br]{[br]	echo '<a href="?show=guestbook"> guestbook </a><br>';[/br]	echo '<a href="?show=info"> info </a>';[br]}[/br]?>
I dunno. Im not sure. I aint good with php
[br]<?[br][/br]define (NL,"\n");[br][/br]if (isset($_GET['show'])=='guestbook')[br][/br]{[br][/br]	echo 'guestbook';[br][/br]}[br][/br]else if (isset($_GET['show']=='info')[br][/br]{[br][/br]	echo 'info';[br][/br]}[br][/br]else[br][/br]{[br][/br]	echo '<a href="?show=guestbook"> guestbook </a><br />' .NL. '<a href="?show=info"> info </a>';[br][/br]}[/br]?>

That should be more efficient.

Share this post


Link to post
Share on other sites

<?
define (NL,"\n");

if (isset($_GET['show'])=='guestbook')

{

echo 'guestbook';

}

else if (isset($_GET['show']=='info')

{

echo 'info';

}

else

{

echo '<a href="?show=guestbook"> guestbook </a><br />' .NL. '<a href="?show=info"> info </a>';

}
?>

Parse error: parse error, unexpected T_IS_EQUAL, expecting ',' or ')' in /home/jailbox/public_html/test/testing.php on line 22


what you are trying to accomplish could be possible with flatfiles,although we can't help you with the technicalities of the code,
unless we actually see your code. maybe you can upload your
bare code in your site, and have us review it for alteration/
modification to the end you desire. smile.gif

or better yet, start learning more PHP and MySQL to maximize the
features of Xisto hosting. smile.gif i'm wary of using flatfiles since they
are not really that secure enough. at least that's what i think, since
they can essentially be called directly from the browser
(example: http://ww38.yoursite.com/flatfilename.txt). tongue.gif heheheü
anyway, a flatfile has its uses, but i won't use it if i want to make
some/all content in it secure.


You misunderstood

Share this post


Link to post
Share on other sites

These are all great ways to do it. For the sake of conversation, here is a variation on the theme.

In some of the enterprise projects that I work on we will use a "mode" which is simply defined by the text post ? (eg. myfile.php?mypage would be "mypage" mode).

I will often grab the $QUERY_STRING as the mode, or parse it if anything else is on the GET string.

Eg.

$mode = $QUERY_STRING;[br]switch ($mode) {[/br] case "mode1":[br]   include_once("Mode1.class.php");[/br]   ...[br] case "mode2":[/br]   include_once("Mode2.class.php");[br]   ...[/br]}

So if I went to mypage.php?mode1 it would include the Mode1 class and then you could execute some functionality out of that.

You will notice that this does not limit the code to one file, but it does limit it to one URL. I love this combination - it consolidates as many functions as you want into one URL, maintains code in manageable classes, and helps you avoid having to come up with strange new names for each page that you want to do something.

Share this post


Link to post
Share on other sites

I know its possible to put many pages inside 1 file. But how? Lets say you have a guestbook with different pages for signing and viewing. How to make so those pages are in 1 file? ;)

I know i am very late to reply for this question. but i thaught of expressing my knowledge for those who are requiring information related to this topic.
According to my view point on your statements, Here below is the solution for your question
<?phpinclude("page1.html");?><?phpinclude("page2.php");?><?phpinclude("page3.html");?>
all the above codes should be placed in 1 file.
in this way you can show 3 different html pages in 1 single page.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.