Real Estate Forums

Coding HTML, ASP, PHP, JAVA MYSQL and more. All coding questions should be asked here.

Reply
 
Thread Tools Display Modes
Old 06-01-2007, 12:52 PM
Capt. Mike's Avatar
Capt. Mike Capt. Mike is offline
New real estate webmaster
 
Join Date: Dec 2006
Location: Panama City Beach, FL 32413
Posts: 28
Capt. Mike is on a distinguished road
Cool Convert Include to php include

hi folks,
I am slowly converting my site to use .php pages. It is currently using includes and .shtml and .html pages.

What is the code for the following include coverted to a php include?

<!--#include virtual="/my-directory/mypage-to-be-included.html"-->
__________________
Kind regards, Capt. Mike Foate - By Land or By Sea!

Panama City Beach Real Estate-Homes and Condos For Sale

GOT FISH? SEE FISH?

CAPT. MIKE'S CELL: 850-596-4236

Capt. Mike Foate-REALTOR®
Prudential Shimmering Sands Realty
400 S. Hwy 79
Panama City Beach, FL 32413
Reply With Quote
Old 06-01-2007, 01:05 PM
Mouse's Avatar
Mouse Mouse is offline
Advancing Webmaster
 
Join Date: Apr 2007
Location: Austin, Tx
Posts: 60
Mouse is on a distinguished road
Default Re: Convert Include to php include

The easiest way would be:

PHP Code:
<?php require_once("\my-directory\mypage-to-be-included.html"); ?>
Reply With Quote
Old 06-01-2007, 01:11 PM
mkrotchie's Avatar
mkrotchie mkrotchie is offline
Real Estate WebMaster
 
Join Date: Mar 2007
Location: Tucson, AZ
Posts: 173
mkrotchie is on a distinguished road
Send a message via AIM to mkrotchie Send a message via Yahoo to mkrotchie
Default Re: Convert Include to php include

I think include_once() may be a better option, IIRC if the resource is not found using require_once() or require() it may throw an error and not render the rest of the page.
__________________
Michael Krotchie - REALTOR® - Coldwell Banker Residential Brokerage, NRT LLC
6970 N. Oracle Road, Suite 100
Tucson, AZ 85704
520.404.4996 -- Mobile
520.544.4545 -- Office

Tucson Real Estate | Tucson Real Estate Blog
Reply With Quote
Old 06-01-2007, 01:18 PM
Capt. Mike's Avatar
Capt. Mike Capt. Mike is offline
New real estate webmaster
 
Join Date: Dec 2006
Location: Panama City Beach, FL 32413
Posts: 28
Capt. Mike is on a distinguished road
Default Re: Convert Include to php include

geez you guys are quick! I guess I'll wait until the dust settles because we got differing opinions... ;-)

Is ok to include .html pages in a .php page?
Kind regards, Capt. Mike
Reply With Quote
Old 06-01-2007, 01:20 PM
Mouse's Avatar
Mouse Mouse is offline
Advancing Webmaster
 
Join Date: Apr 2007
Location: Austin, Tx
Posts: 60
Mouse is on a distinguished road
Default Re: Convert Include to php include

That is correct, you'll get a error if your path is named wrong.
Reply With Quote
Old 06-01-2007, 01:24 PM
mkrotchie's Avatar
mkrotchie mkrotchie is offline
Real Estate WebMaster
 
Join Date: Mar 2007
Location: Tucson, AZ
Posts: 173
mkrotchie is on a distinguished road
Send a message via AIM to mkrotchie Send a message via Yahoo to mkrotchie
Default Re: Convert Include to php include

I put up a couple example pages to show the difference; and yes, it is okay to include .html pages in a .php page... I do it all the time.

Example using require_once()
www (dot) michaelkrotchie.com/require_once.php
Code:
<?php 

require_once("nothere.html");

?>
Example using include_once()
www (dot) michaelkrotchie.com/include_once.php
Code:
<?php 

include_once("nothere.html");

?>
So it displays an error either way, just depends how you want to handle the rest of the page. If you have the file there it doesn't really matter I think.
__________________
Michael Krotchie - REALTOR® - Coldwell Banker Residential Brokerage, NRT LLC
6970 N. Oracle Road, Suite 100
Tucson, AZ 85704
520.404.4996 -- Mobile
520.544.4545 -- Office

Tucson Real Estate | Tucson Real Estate Blog

Last edited by mkrotchie; 06-01-2007 at 01:33 PM. Reason: not sure if I am allowed to direct link to my site.. subsituted (dot)
Reply With Quote
Old 06-01-2007, 01:31 PM
Capt. Mike's Avatar
Capt. Mike Capt. Mike is offline
New real estate webmaster
 
Join Date: Dec 2006
Location: Panama City Beach, FL 32413
Posts: 28
Capt. Mike is on a distinguished road
Thumbs down Re: Convert Include to php include

Heck you guys are GREAT! :-)

Thanks for your help! Now I gotta figure out how to slowly migrate the pages with the extensions changed from .shtml to .php and not get dinged too bad in the search engines.

I suppose I should research and see if there is some sort of mod rewrite solution...

Thanks you guys! Have a GREAT weekend!
Kind regards, Capt. Mike

Last edited by Capt. Mike; 06-01-2007 at 02:00 PM.
Reply With Quote
Old 06-03-2007, 11:36 AM
RESynergy RESynergy is offline
Real Estate WebMaster
 
Join Date: Nov 2006
Posts: 109
RESynergy is on a distinguished road
Default Re: Convert Include to php include

Here is some code you can play with. Place it in a page, then call up that page in a browsers something like this -www.your-domain.com/your_page.php/1/2/3/4/5/6 and you will see how it works. I put a few "echos" in there so you can see waht it does. Change the browser url to www.your-domain.com/your_page.php/6/5/4/3/2/1 and you'll see it.

I've used that system quite a bit and have good luck with it.

SE friendly urls - http://www.sitepoint.com/article/sea...riendly-urls/2

Here's the code

<?
$file=eregi_replace($_SERVER['SERVER_NAME'], "", $_SERVER['PHP_SELF']);
$var=explode("/", $file);


$affiliate_num_test = $var[3] ;//repnaming header_ID
echo '$affiliate_num_test = ', $affiliate_num_test;?><BR><?
$url_cat = $var[4] ;
echo '$url_cat = ', $url_cat;?><BR><?
$cat_record_num = $var[5] ;
$cat_page_total = $var[6] ;
$cat_page_id = $var[7] ;
$link_page_id = $var[8] ;
$link_page_total = $var[9] ;
$link_record_num = $var[10] ;
echo 'link_record_num = ', link_record_num;?><BR><?

include("http://Bungeebones.com/link_exchange/index.php/$affiliate_num/$url_cat/$cat_record_num/$cat_page_total/$cat_page_id/$link_page_id/$link_page_total/$link_record_num");
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



For our members

Main Sections

IDX Coverage Areas

Spiders Welcome

All times are GMT -7. The time now is 05:15 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.