Contact Us Forum Rules Search Archive
WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

View Poll Results: Did you find this helpful for a Php Include issue?
Yes, this worked in resolving my situation. 20 20.83%
Yes, it worked but I encountered other problems. 34 35.42%
No, this solution was not beneficial for my situation. 42 43.75%
Voters: 96. You may not vote on this poll

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-27-2004, 07:24 AM
WebProWorld New Member
 

Join Date: Jun 2004
Location: New Jersey
Posts: 19
mjmls RepRank 0
Default Php Includes - A simple solution to use external Php Code

A simple solution to Php Includes
I have recently created my first Php program. I wanted to share with others some of the problems that I encountered and how I finally overcame them obstacles.


My Reason for Php Includes

To start, my most recent website features a free classified advertising solution, a modified version of PhpBB stripped to function as an Article Bulletin Board (No replying), and a link directory. The business model of my Website offers free Classified Advertising, but charges a small fee for enhanced advertisements (Featured, Bolded, and Better Placement). The Classifieds were purchased from a developer, so I had little experience with the application. The link directory was a free resource of an old program that I modernized a bit. I choose the old link directory because the links are clean. They are not replaced with coding to count outbound traffic. I figured this would increase the value of links, to sites who exchanged links with me.

To increase revenue on the new site, I realized that I needed to increase the value of, “Featured Advertisements”. To do this I wanted to randomly rotate featured advertisements across my Bulletin Boards and Link Directory. Bare in mind, all three are run from a unique table, and I wanted to leave it that way.

Where the Php Include Trouble Started

I started reading tutorials and utilizing Forums to create a Php program for external pages on the site. The program would pull a random featured ad from the classified table. This program only took me about 32 hours to create, while performing research. I didn't intend to get into the schematics of the program with this post, so forgive me if you are looking for a Random generator. I would be more than happy to share my code upon request.

The code I created was simple, it worked just the way I wanted, but I ran into one cumbersome obstacle; how do I implement this easily across two unique table driven applications?

I started reading tutorials on, "Php includes and functions and classes". I realized quickly that this was a bit more confusing than creating the actual coding. In addition, I ran into parsing errors if I included the new coding in only one application.

Using the, "Include ()," Php function caused parsing errors, What happen and my simple solution

I found that very few people were willing to provide any feedback for such a problem, even in the most resourceful forums for Php Coding. I fumbled with the coding for over 72 hours. I thought this was a bit ridiculous, as the code itself took less time to create.

I finally came across a helpful solution that may prove beneficial, if you are in the same situation with Php Includes. The code was uploaded onto my server as a file (something.php). I took the function out of the link and PhpBB coding. I then called on the file (page) using an Iframe tag on the pages I wanted it to appear.

I waited until Google came around to see how the Iframe affected my sites search rankings. Finally, the other day this happened. The conclusion; my search rankings still went up due to recent link exchanges. The code is working to my needs, and it is easily included on any page that I want, even externals outside my site can call on the code, which opens more doors for advancement.

Here is the simple Iframe code that might help with your Php Includes:
Code:
<iframe align=top valign=right width=600 height=105 marginwidth=0 
marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=no 
src="http://your.com/file-to-include.php" width=600 
height=105></iframe>
Php Include with Iframe Conclusion

I have encountered no problems with including my PHP code on pages across external servers, using the iframe as a Php Include. As you can see from the code above, it is totally customizable. You can specify the width, height, alignment, border, scrolling, margins and more. The only obstacle that I have encountered, is the style sheet that the site, or page, with the, "Php Include," is not utilized. The page that the code is on seems to need its own unique style sheet.

I hope this proves beneficial to anyone having trouble with a "Php Include" across various unique online applications.

Good luck with your websites.
Reply With Quote
  #2 (permalink)  
Old 06-27-2004, 04:18 PM
mushroom's Avatar
WebProWorld Veteran
 

Join Date: Feb 2004
Location: Queen Charlotte B. C. Canada
Posts: 351
mushroom RepRank 0
Default

Php include(); has never been much of a problem for me, but then I never tried to use it to splice to complex scripts from different sources together.

I use includes to standardize the look ie;

include("header.php"); or footer.php

or bypass large cunks of code when not needed ie;

if ($a==$b){include("pageb.php");}
elseif ($a==$c){include("pagec.php");}
........
else ($a==$z){include("pagez.php");}

When the cpu runs in to an if statment it must evaluate it, then if true it exicutes from "{" to "}" but if false it still has to read the "{" and then read on to find the "}" with out exicuting, it still has read all the code.

With includes that's only 1 line with out includes that could be 1000's of lines.

Using includes dose have price, the included page must be fetched. So for repetitive tasks such as dbconect I define a function (held in memory).
__________________
Irony: That for most people the most "trusted" web site on the planet is for a company the has been convicted of criminal activity.

Both Security and SuSe start with "S". www.oldslides.com
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Tags: , , , , , ,



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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0