Please support our PHP advertiser: Lunarpages PHP Web Hosting
![]() |
•
•
Join Date: Jan 2008
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
I have been using PHP sparsely on my website for some time now, but I would like to become more efficient and therefore have a couple questions. They will stream in slowly, bu for right now...
Currently I use the <?php tag many times on a page. Is there a way to get rid of it? Example:
Thanks. Sorry for my newbieness
Currently I use the <?php tag many times on a page. Is there a way to get rid of it? Example:
<?php
require('./cutenews/captcha/php-captcha.inc.php'); //Change the path to your needs
?>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>The Kudzu Gazette</title>
<?php
include("./header_home.php");
?>
<!-- Content Here -->
<?php
include("cutenews/show_news.php");
?>
<!-- End Content -->
<?php
include("./footer.php");
?>Thanks. Sorry for my newbieness
•
•
Join Date: Jan 2008
Posts: 57
Reputation:
Rep Power: 2
Solved Threads: 5
•
•
•
•
I have been using PHP sparsely on my website for some time now, but I would like to become more efficient and therefore have a couple questions. They will stream in slowly, bu for right now...
Currently I use the <?php tag many times on a page. Is there a way to get rid of it?
Sometimes you can cut down on it. Other times it's necessary to open and close php tags a lot.
In your case, you can cut down significantly on the opening/closing brackets. In between the includes, you don't use any regular html. So you can cut them all down into one php segment like so...
php Syntax (Toggle Plain Text)
<?php require('./cutenews/captcha/php-captcha.inc.php'); //Change the path to your needs ?> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>The Kudzu Gazette</title> <?php include("./header_home.php"); include("cutenews/show_news.php"); include("./footer.php"); ?>
And if you wanted to make it all one big php block, you could do this...
php Syntax (Toggle Plain Text)
<?php require('./cutenews/captcha/php-captcha.inc.php'); //Change the path to your needs echo '<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">'; echo '<head>'; echo '<title>The Kudzu Gazette</title>'; include("./header_home.php"); include("cutenews/show_news.php"); include("./footer.php"); ?>
Good luck,
- Walkere
•
•
Join Date: Jan 2008
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
Awesome. thanks.
-Will
-Will
•
•
•
•
Sometimes you can cut down on it. Other times it's necessary to open and close php tags a lot.
In your case, you can cut down significantly on the opening/closing brackets. In between the includes, you don't use any regular html. So you can cut them all down into one php segment like so...
php Syntax (Toggle Plain Text)
<?php require('./cutenews/captcha/php-captcha.inc.php'); //Change the path to your needs ?> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>The Kudzu Gazette</title> <?php include("./header_home.php"); include("cutenews/show_news.php"); include("./footer.php"); ?>
And if you wanted to make it all one big php block, you could do this...
php Syntax (Toggle Plain Text)
<?php require('./cutenews/captcha/php-captcha.inc.php'); //Change the path to your needs echo '<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">'; echo '<head>'; echo '<title>The Kudzu Gazette</title>'; include("./header_home.php"); include("cutenews/show_news.php"); include("./footer.php"); ?>
Good luck,
- Walkere
![]() |
Similar Threads
Other Threads in the PHP Forum
- Simple Shopping Cart with arrays (PHP)
- it's simple but yet complicated...php and mysql search.. (PHP)
- php number format (PHP)
- Php With Pdf (PHP)
- Multiple Forms Question PHP (PHP)
- Just a simple question. (PHP)
- PHP question i think! (Site Layout and Usability)
Other Threads in the PHP Forum
- Previous Thread: multi-file Class in PHP
- Next Thread: Form display settings
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)





Linear Mode