•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 402,753 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,481 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1740 | Replies: 7
![]() |
I am new at php so this might me a dumb question.
Is it possible to use part of an include file another words i make an 1 big include file and only use parts of it as needed and not make many include files.
Also is it possible to delete an whole variable so that it dont messes thing up when we get back to same page with diffrent info in th variable.
Is it possible to use part of an include file another words i make an 1 big include file and only use parts of it as needed and not make many include files.
Also is it possible to delete an whole variable so that it dont messes thing up when we get back to same page with diffrent info in th variable.
•
•
Join Date: Jul 2005
Posts: 12
Reputation:
Rep Power: 4
Solved Threads: 0
•
•
•
•
Originally Posted by ashneet
I am new at php so this might me a dumb question.
Is it possible to use part of an include file another words i make an 1 big include file and only use parts of it as needed and not make many include files.
Also is it possible to delete an whole variable so that it dont messes thing up when we get back to same page with diffrent info in th variable.
In the include file, if you do if statements, you can then include parts of it. This is how I typically call parts of an include file. Example of an include.php...
[PHP]<?php if ( $page == "1" ) { ?>
Page 1
<?php elseif ($page == "2" ) { ?>
Page 2[/PHP]
And so forth. Call it like this...
[PHP]<?php include "include.php?page=1"; ?>[/PHP]
Second, to "delete" a variable, you can use the unset function. This essentially destroys the variable.
[PHP]<?php unset($var1, $var2, $var3); ?>[/PHP]
Hope this helps.
•
•
Join Date: Jun 2005
Location: Kansas City, Missouri, USA
Posts: 344
Reputation:
Rep Power: 4
Solved Threads: 4
You do not set or unset the built in $_POST, $_GET. They only exist for the life of the script. They do not persist between server hits.
Hi!
I also have a couple of questions to the include function of php! :!:
I don't know if it's possible to make:
Lest say i have index.php file, where i have included = photos.html with thumbnails, and if a click on one of the tn-s that this include changes to tn01.html where the bigpicture is, and if i click here on 'return'-link include will change back to photos.html????
I also have a couple of questions to the include function of php! :!:
I don't know if it's possible to make:
Lest say i have index.php file, where i have included = photos.html with thumbnails, and if a click on one of the tn-s that this include changes to tn01.html where the bigpicture is, and if i click here on 'return'-link include will change back to photos.html????
•
•
Join Date: Jun 2005
Location: Kansas City, Missouri, USA
Posts: 344
Reputation:
Rep Power: 4
Solved Threads: 4
•
•
•
•
Originally Posted by Class
Lest say i have index.php file, where i have included = photos.html with thumbnails, and if a click on one of the tn-s that this include changes to tn01.html where the bigpicture is, and if i click here on 'return'-link include will change back to photos.html????
Class, first of all, just want you to know that at Daniweb, we prefer you to create your own thread rather than post a new question to somebody else's thread. It helps keep the discussion in a particular thread focused. Also, it will help you get a response as people tend to look for threads with zero replies to see if they can help.
bgharper shows one example of what you can do in this very thread--scroll up to his post to see it. In his example, you could create a single page that either displays the thumbnails or displays a single photo. This one page could then be included. But to answer your question, yes. With PHP, you can conditionally include files. This is NOT an option with ASP/VBScript--one of the many powerful advantages of PHP. You just use standard if/else/end or select/case logic to conditionally include files. Check out include(), require(), and my favorite, require_once().
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Basic PHP Includes (PHP)
- Test For Php Includes (PHP)
- PHP Includes??? (PHP)
- Setting up PHP (PHP)
- Hosting multiple Apache/PHP/mysql sites - how many? (Linux Servers and Apache)
- Multiple PHP INCLUDES (PHP)
Other Threads in the PHP Forum
- Previous Thread: Random IMG
- Next Thread: redirect doesn't redirect without refresh


Linear Mode