| | |
PHP Includes +
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
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:
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.
[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.
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????
•
•
•
•
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????
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().
![]() |
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
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database dataentry date directory display download dynamic echo email error file files firstoptioninphpdroplist folder form forms freelancing function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select server sessions sms soap sorting source space speed sql structure syntax system table tutorial tutorials update upload url validation validator variable video web white xml youtube zend





