Embeds vs. PHP Includes
Posted: 02 September 2008 12:46 PM   [ Ignore ]  
Grad Student
Avatar
Rank
Total Posts:  54
Joined  07-31-2007

Which technique will render the embedded/included code fastest? I’m concerned about load time on a current project.

Thanks,

Kevin

Profile
 
 
Posted: 02 September 2008 12:49 PM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  12433
Joined  04-29-2002

It just depends. What are you trying to include?

 Signature 

Quick Reference - EE Trial Options - EE Wiki - Docs for updating a build

Profile
MSG
 
 
Posted: 02 September 2008 12:49 PM   [ Ignore ]   [ # 2 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32921
Joined  05-14-2004

You might first ask about which is possible in your situation. For instance, do PHP Include an EE Template, you have to be able to PHP include by URL since the template groups and templates are virtual, not real.  Many hosts do not allow PHP includes by URL.

So it really depends what you need to do; you an always cache your embeds, of course.

 Signature 
Profile
MSG
 
 
Posted: 02 September 2008 04:04 PM   [ Ignore ]   [ # 3 ]  
Grad Student
Avatar
Rank
Total Posts:  54
Joined  07-31-2007

Two examples:

1. Header info - stuff like doctype, metadata that will remain the same for each page.
2. Style sheet - better to keep this outside my EE install and like to it via a php include or inside EE with an embed? Which will give me better performance?

Profile
 
 
Posted: 02 September 2008 05:01 PM   [ Ignore ]   [ # 4 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32921
Joined  05-14-2004

For header info, use a User Defined Global Template, I’d say.

If you’re going to keep it outside of your EE install, you wouldn’t link to it via PHP - you’d call it as a <link> just like any standard HTML.  In EE, the same, you wouldn’t embed your stylesheet, you’d link it.

 Signature 
Profile
MSG
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 65086 Total Logged-in Users: 35
Total Topics: 82224 Total Anonymous Users: 20
Total Replies: 441922 Total Guests: 187
Total Posts: 524146    
Members ( View Memberlist )