Jul 25, 2008

Pages In 1 File

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

free web hosting

Pages In 1 File

jailbox
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? huh.gif

Reply

Magic-Node
I don’t understand what you mean can you explain better ?

Reply

jailbox
QUOTE
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

Reply

Magic-Node
Do you mean something like this?

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

Reply

jailbox
QUOTE(Magic-Node @ Sep 20 2004, 05:02 PM)
Do you mean something like this?

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

I dunno. Im not sure. I aint good with php

Reply

serverph
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 trap17 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://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.

 

 

 


Reply

Tonglebeak
QUOTE(jailbox @ Sep 20 2004, 10:54 PM)
QUOTE(Magic-Node @ Sep 20 2004, 05:02 PM)
Do you mean something like this?

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

I dunno. Im not sure. I aint good with php

CODE

<?

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>';

}
?>


That should be more efficient.

Reply

jailbox
QUOTE
<?

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


QUOTE
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 trap17 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://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

Reply

virrey
you must switch based in $_REQUEST[action]
then because i don like to mix phpcode with html
i use IT (pear.php.net)

Reply

whatknows
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.

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


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.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : pages file

  1. Php Configuration File - "config.php" (16)
  2. Getting List Of Directories And Files Using Php - PHP Function for Directory and File List (6)
    is there a php function that lists the content of some folder.... example: /New folder new.txt
    left.gif download.zip dc.exe ....so is there..? /rolleyes.gif' border='0'
    style='vertical-align:middle' alt='rolleyes.gif' /> ...
  3. Include File.php?id=something - using the include() function (13)
    Well, I am making a full CMS system for my site, and want to make the index.php file to include the
    view.php?id=1 file. I tried with this code, but it didn't work: CODE <?php include
    'view.php?id=1' ?> This is the error I get: CODE Warning:
    main(view.php?id=1) [function.main]: failed to open stream: Invalid argument
    in C:\server\xampp\htdocs\test\index.php on line 1 Warning:
    main() [function.include]: Failed opening 'view.php?id=1' for inclusion
    (i...
  4. Script: Php Jukebox - A one file script! (4)
    This scripts is so simple, you dont need to edit ANY of it! All you have to do is make a folder
    called 'songs' and put some audio files in it. Here is the whole page, I named it index.php
    and put it in a folder called 'music': CODE <!DOCTYPE HTML PUBLIC
    "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd"> <html> <head>
    <title>PHP jukebox</title> </head> <body> <!-- ©2005 Craig
    lloyd. All rights reserved. Visit cragllo.com for more sc...
  5. Protect Pages - HOW? (20)
    I create certain pages for my web-site, and I would like to protect them that no one can hack or see
    their source codes. So, if everybody knows how to do it, please post a reply over here. List of
    the best ways, I can do it. Thanks....
  6. Need Some Help In File Browser - listing all sub folders and files in them. (8)
    Hey I want to create a very simple file browser, so that, it reads all the sub-folders which are
    places in a directory, and the files inside the sub-folders (It reads only files inside sub-folders
    and list them in simply. ) Also, it creates a directory (any name) inside each sub folder. My
    Following code reads on the files inside the main directory, it does not read the files inside the
    sub-folders.. I appreciate any help. CODE <? $path = "./"; $dir_handle =
    @opendir($path) or die("Unable to open $path"); whil...
  7. Dynamic Php Pages - Nice tutorial (5)
    This is a really good tutorial on making php pages that normally appear as
    www.domainname.com/links.php appear as www.domainname.com/index.php?page=links
    http://nuwen.com/tutorials/php-dynamic-pages ...
  8. Pagination - ? (3)
    People they create the databases in which like the news stories are placed. Then that news stories,
    they are placed on certain page to be displayed and readable by other users on the web-site. How
    people do that thing paging, like you can see bottom, whenever, you go to Any CMS engines. Need the
    concept how you can create, 1, 2 or 3 pages, then next and back buttons, last and beginning page....
  9. Updating Php File Through A Web Form - (5)
    Hello, i'm not sure if this can be done with php or not but what i need is a way to make an php
    file that have an html form on it and it will take the info you put in to that form and write it to
    an existing php file, for example: if i have the file news.php and the file news_update.php. if you
    went to news_update.php you would get an form with a text area for you to write a new addition for
    the news.php file and when you hit submit it will add what you typed in the form to the file
    news.php. If this is going to be a big code or a hard one to make but some one think...
  10. 2 Pages Into One - how? (10)
    Hello, now this may be a stupid question but i'm very new to php so i need some help. what
    i'm wanting to do is combine 2 pages in to one. like for example the install.php for
    invisionpower board it starts with one page and you click continue and it gives you a whole new page
    but if you look at the url you are still using the install.php file but it has somethinglike "?a=2"
    at the end. how can i do this. Thanks...
  11. Php Pages Problem [resolved] - Please help me im stuck ;-( (5)
    Hi, i have been working with a wap forum script, translating from russian and fixing errors etc..
    but now im stuck, the problem is with the pages while viewing a forum.. Let me explain.. the pages
    are set to show ten topics per page which all works fine as you can see in these screenshots: page
    1: page 2: The problem occurs when there are PINNED topics (with the redish folder), it will
    show ten topics but also the pinned ones on page one, and the "Next" link will appear before it
    should leading to a blank page where there should be topics but they are still on th...
  12. File Checker-how To Check File Whith Html Through Html? - (2)
    edit:sorry for the mistake it is php not html and its with not whith my code checking script= CODE
    <?php $file = '$CHECK'; if (file_exists($file)) {
        echo "The file $filename exists"; } else {     echo "The file $filename
    does not exist"; } ?> my question is how to check the file whith html example:on a page
    a text box is provided and a button the user writes a file name (or website) the user clicks on the
    submit button then it checks and show it (with the code above) i got the code C...
  13. Php And Flash Image Gallery - Need some help in creating or editing an xml file while viewing some o (5)
    Hello there and thanks for the helping hand you are offering. PHP newbie here! /ph34r.gif"
    style="vertical-align:middle" emoid=":ph34r:" border="0" alt="ph34r.gif" /> So here is my problem:
    On my website I have a flash image gallery.The way the gallery works is by uploading pictures in a
    folder and editing? an xml file.(pics.xml) where it adds the following code when you upload a
    picture: CODE <pictures>     <image location="nameofpicture1.jpg"
    desc="" />     <image location="nameofpicture2.jpg" desc="" /&#...
  14. Php An Js Window.open Pages Trouble. - I need a way to set hidden input values to the new window. (3)
    I have 2 main pages Page A(events_locked.php) and Page B(add_attendance.php). Both are php files.
    Page A takes a post var from another page(not Page B ) and then used to query for displaying records
    in a mysql datase. This variable has set as a session variable because there is 1 <script
    LANGUAGE="JavaScript"> window.name="main_index"; function openFormWindow() {
    OpenWindow=window.open("add_attendance.php", "newwin", "height=250,
    width=400,toolbar=no,scrollbars=no,menubar=no,location=no,resizable=no"); var x =
    getElementByName("form1"); x.target="newwin"; x.s...
  15. No File Extension - (3)
    On MediaWiki, the URL of the content is http://YOURWIKI.com/index.php/Blah Is it possible to
    create a page or two that doesn't have a file extension? If so, how is it done?...
  16. File Upload - File upload (1)
    I need to add a facility on my customer's website so his clients can send him jobs, typically
    5mb - 50mb. I've looked around the web and researched this, and tried a few tests (failed), but
    my brain's beginning to hurt. Could someone please tell me the best way to go about this,
    please. The site is done in Flash, but I'm sure a link to an html page would be ok if necessary....
  17. Php Pages Permission On Apache Server - PHP pages permission on Apache Server (1)
    Hello, I want to know what permissions for PHP pages should be given on Apache web server so that
    PHP pages can be executed. If PHP pages are in a folder, what permissions should be given for that
    folder? ...
  18. <?php ?> Unique Visitors Script - Flat file unique visitors script (no sessions) (2)
    This is really simple script. Well at least this part is, but it could be extendable. Only problem
    is that it's not really for massive websites with hundread of visitors a day, but rather for
    small ones. But it is a good script to figure out how to make a visitor counter script. Anyway
    here's the snippet. CODE <?php function getVisits($variable) {
        $visits = array();     if ($handle =
    opendir('stats/')) {     while (false !== ($file =
    readdir($handle))) {  ...
  19. [php]simple Flat File Text Manipulator - Example on how to use forms to write to files in PHP (3)
    I made a simple flat file text editor, that can show you probably how simple it is to use forms with
    php and write that data to file. This example has 2 files, submit.php, and postit.html. Submit.php
    is used to write title, and some text, and add html tags, and paragraph tags where new paragraphs
    are. Here's the file with comments. I think that HTML really doesn't need some more
    explaining. CODE Title: <br /> <input type="text"
    name="title" size="53"> <br /> Text: <br />
    <textarea nam...
  20. Edit .txt File In Ftp Via Webpage - file on external ftp (2)
    Right Im new here and stuggling with a problem im having. I've currently got a Login Script to
    login to a external ftp and it displays the folders contents, however i need it so it echos a
    specific file (coursedata.cfg) into a formarea which you can then edit the file and when u click
    save it overwrites the file with the new one. Im really quiet getting annoyed with it xD as
    everything i do ends up trying to include the file from the webserver the script is hosted on and
    not the external ftp source. thanks Full Code Bellow Simple FTP Manager body { fon...
  21. Putting Data Of 2 Pages In Mysql At Once - (1)
    suppose i have a page, page.php?part=1 there i have some text fields. user will give input, but
    after taking input, it will not put the data in mysql .. but it will take to the next step..
    page.php?part=2 (if any field is left blank, it will not go to next page.. ) . and there also some
    fields.. after the user has filled that form also, then it will insert all data (from part1 and
    part 2) in mysql. i want to ask, how i can collect data from 2 pages and put in mysql at once....
  22. Php Help Needed Including File In A Page. - (2)
    i'm a noob in php programming, i can understand and modify php programs, but i dont know to
    write on my own. So please somebody who is well versed in php help me. My need is, I'm
    currently builiding a knowledge base website , i've my own design for the website, check here,
    http://laschatz.info/kzone/ Each page in the left hand site has a tree navigation of all the
    topics available. Since this information must be same in all the pages, presently I need to change
    all the pages after adding a new category. Could you please help me in such a way that I can ad...
  23. Help Php: How To Load String From Text File (solved) - Loading string from text file when you click on your link (9)
    I learned the way to load other files with the code posted on this forum. Now i wanted to try
    something for my side menu. I am calling this a string, --> $tekst , maybe it's
    called something else i'm not sure Now let's say i have a file called details.txt In that
    file i would like to have something like this $detailsaboutphp1 = ("details details details
    1"); $detailsaboutphp2 = ("details details details and even more details 2"); How to make a
    code that loads those $strings on click of a mouse. When we tried to load extern...
  24. I Need Help With File Edit In Php - with ftp (6)
    Currently i have CODE <?php if($_POST['user']=="" or
    $_POST['pass']=="" or $_POST['host']==""
    or $_POST['root']=="" or
    !isset($_POST['run'])){  print('<form method=post
    name=form>');  print('FTP username <input type=\'text\'
    name=user value=""><br>');  print('FTP password <input
    type=\'password\'...
  25. Help Needed With Directory/file Listing Code Infinite Loop - Made an infinite loop but why is this so? (5)
    Hi all ive got a small and simple (for the moment atleast /unsure.gif"
    style="vertical-align:middle" emoid=":unsure:" border="0" alt="unsure.gif" /> )file and directory
    listing script in php as follows CODE $dir = "."; $num = 0; $file =
    scandir($dir); while($file = scandir($dir)){     echo
    $file[$num];     echo "<BR>";     $num = $num + 1;     
    }; the concept is simple enough, the directory to start with is the current one, so scan this
    directory and wh...
  26. Display Random File In A Directory - how to display a random file from a set directory. (9)
    hi, could someone please help me with this? I have some files in a directory and i want to know how
    i can randomly display link/s to one or more of the files in my directory for download. But it must
    not at any time display index.php which is also in the directory with the downloads. Thanks in
    advance for any help given /unsure.gif" style="vertical-align:middle" emoid=":unsure:" border="0"
    alt="unsure.gif" />...
  27. File Format Unknown! (wap) - someone PLEASE HELP! (6)
    hi people :-) listen please can someone help me find the error in this wapsite page, its driving me
    nuts! It works fine on some phones but not on others (giving a file format unknown error) and im
    having serious problems finding the error but i bet its something stupid/simple. CODE <?php
    include ("config.php"); include ("core.php");
    header("Content-type: text/vnd.wap.wml"); header("Cache-Control:
    nostore, nocache, mustrevalidate"); print "<?xml version=\"1.0\&#...
  28. File In Database - Question.thanks (1)
    Hi all i write this code i want when you see download.php (this code) my file goes for download for
    user sorry my english is not very good its a file database project for my university but when i
    browse this code my soruce file (.zip) echo in my page and dont goes for download my next querstion
    about safe mode i saw (php.net and zend) when safemode is on file databaseing and header() is not
    working . is it true ? if is it true i save my file at hosting and no (database) i want write
    standard script . plz help me thanks more and more CODE include("config.php&...
  29. Php Writes Into Txt File - a question (8)
    QUOTE $fp=fopen("test.txt","a"); fputs($fp,"ok"); ?> The above method is only to
    add "ok" at the end (DO NOT write on a new line) I want to know... How to add data on a new line
    and at the end of txt file??! thx~...
  30. File String Delete? - (2)
    Say i have a file file.txt... Can someone give me an example of how to delete a string from this
    file ie.. The file contains: wappy::sucks::at::php --- i want to delete sucks::...



Looking for pages, 1, file

Searching Video's for pages, 1, file
Php
Configuratio
n File
"config.
php"
Getting List
Of
Directories
And Files
Using Php
PHP Function
for
Directory
and File
List
Include
File.php?id=
something
using the
include()
function
Script: Php
Jukebox A
one file
script!
Protect
Pages HOW?
Need Some
Help In File
Browser
listing all
sub folders
and files in
them.
Dynamic Php
Pages Nice
tutorial
Pagination ?
Updating Php
File Through
A Web Form
2 Pages Into
One how?
Php Pages
Problem
[resolved]
Please help
me im stuck
;-(
File
Checker-how
To Check
File Whith
Html Through
Html?
Php And
Flash Image
Gallery Need
some help in
creating or
editing an
xml file
while
viewing some
o
Php An Js
Window.open
Pages
Trouble. I
need a way
to set
hidden input
values to
the new
window.
No File
Extension
File Upload
File upload
Php Pages
Permission
On Apache
Server PHP
pages
permission
on Apache
Server
<?php
?> Unique
Visitors
Script Flat
file unique
visitors
script (no
sessions)
[php]simple
Flat File
Text
Manipulator
Example on
how to use
forms to
write to
files in PHP
Edit .txt
File In Ftp
Via Webpage
file on
external ftp
Putting Data
Of 2 Pages
In Mysql At
Once
Php Help
Needed
Including
File In A
Page.
Help Php:
How To Load
String From
Text File
(solved)
Loading
string from
text file
when you
click on
your link
I Need Help
With File
Edit In Php
with ftp
Help Needed
With
Directory/fi
le Listing
Code
Infinite
Loop Made an
infinite
loop but why
is this so?
Display
Random File
In A
Directory
how to
display a
random file
from a set
directory.
File Format
Unknown!
(wap)
someone
PLEASE
HELP!
File In
Database
Question.tha
nks
Php Writes
Into Txt
File a
question
File String
Delete?
advertisement



Pages In 1 File



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE