jailbox 0 Report post Posted September 19, 2004 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? Share this post Link to post Share on other sites
Magic-Node 0 Report post Posted September 19, 2004 I don?t understand what you mean can you explain better ? Share this post Link to post Share on other sites
jailbox 0 Report post Posted September 20, 2004 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
Magic-Node 0 Report post Posted September 20, 2004 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
jailbox 0 Report post Posted September 20, 2004 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
serverph 0 Report post Posted September 20, 2004 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 yourbare 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, sincethey 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
Tonglebeak 0 Report post Posted September 20, 2004 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
jailbox 0 Report post Posted September 21, 2004 <?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 22what 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 yourbare code in your site, and have us review it for alteration/modification to the end you desire. smile.gifor better yet, start learning more PHP and MySQL to maximize thefeatures of Xisto hosting. smile.gif i'm wary of using flatfiles since theyare not really that secure enough. at least that's what i think, sincethey 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 makesome/all content in it secure. You misunderstood Share this post Link to post Share on other sites
virrey 0 Report post Posted October 8, 2004 you must switch based in $_REQUEST[action]then because i don like to mix phpcode with htmli use IT (pear.php.net) Share this post Link to post Share on other sites
whatknows 0 Report post Posted October 10, 2004 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
iworld200 0 Report post Posted August 19, 2009 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