473,385 Members | 1,587 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

2 methods of including files sequence

I'm making some changes in files structure in my CMS. I will use more
templates for modules. However, the topic of <titleand other ...
came back when i was thinking about it.

---- Pre-generating (A) ----

It uses output buffering. Modules files are included before <html>.
The whole middle output (e.g. article with comment, registration
form) is stored in RAM (or SWAP :D) and prepared for putting it into
the main layout inside <body>. Menus aren't stored in "output
buffering" memory.

Advantage:
:: <titleand <headcontent may be set using variables

Disadvantage:
:: Wideli (significantly) more RAM usage (e.g. 10 simultaneous
requests for 50 kb = 500 kb).
---- Generating step-by-step ----

All modules are included from the main layout from PHP basing on MOD
constant defined by index.php. However, there is additional file for
"content" modules (articles, files, images, free subpages and news) -
content.php - which gets data from database (about their category
also) and sets <titleif user have access to them. For another
modules, index.php sets <titleautomatically if $lang['module_name']
exists, e.g. $lang['users']. Perhaps, "View user: anonymous" title
isn't as important.

Advantage:
:: Lower RAM usage (big contents aren't stored twice)

Disadvantage:
:: Most modules can't access <headcontent

Some people often avoid items in Google if they can't see bold title.
However, does it concern other modules than "content" modules (e.g.
user - username, poll - pollname, news archive)?

Jun 23 '07 #1
2 1505
There is also another way to make all modules (or choosen) access to
<titleand <head>. Index.php includes one file before <html(which
gets data and sets <titleand other <headfiles). That file also
defines MOD constant.
The main layout included by index.php in <bodyincludes other file
(defined in MOD constant) which displays data.

Advantages:
:: Less memory usage
:: All modules (or choosen) can access <titleand <head>

Disadvantages:
:: More files (the second in <bodyrather must contain PHP)
:: Sometimes modules needs to show an information only. Including
additional file for doing only it is impractical.
However, if <title>s like "Show user: [username]", "Poll:
[pollname]" (I can add POLL module to including before <htmlbecause
I have to include other file with PHP code too), "Archive from 1st
May", "Private messages: folder Inbox" aren't so needed for users or
search engines, I think that "generating step-by-step" method isn't
very bad.

What do you think about it? The main goal of this CMS is speed,
performance and low RAM usage. People say that output buffering is
slow and developed for other usages than it.

Jun 23 '07 #2
webcm123 wrote:
I'm making some changes in files structure in my CMS. I will use more
templates for modules. However, the topic of <titleand other ...
came back when i was thinking about it.
Personally, my modules are PHP objects which must implement some particular
plugin interface which is defined by the CMS. (There are several different
interfaces depending on what the plugin is supposed to do, but I'm going
to describe the "panel" interface, which allows a plugin to add a piece of
content, including a title, to the page.)

object SomePanel
{
public function get_title()
{
// ...
}

public function get_body()
{
// ...
}
}

At the start, the CMS will create a SomePanel object:

require 'plugins/SomePanel.php';
$obj = new SomePanel;

Then when it needs to find the panel's title:

$title = $obj->get_title();

and when it needs to output the panel's body:

echo $obj->get_body();

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 3 days, 11:48.]

A New Look for TobyInkster.co.uk
http://tobyinkster.co.uk/blog/2007/06/22/new-look/
Jun 24 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

35
by: Raymond Hettinger | last post by:
Here is a discussion draft of a potential PEP. The ideas grew out of the discussion on pep-284. Comments are invited. Dart throwing is optional. Raymond Hettinger ...
99
by: David MacQuigg | last post by:
I'm not getting any feedback on the most important benefit in my proposed "Ideas for Python 3" thread - the unification of methods and functions. Perhaps it was buried among too many other less...
0
by: Anthony Baxter | last post by:
To go along with the 2.4a3 release, here's an updated version of the decorator PEP. It describes the state of decorators as they are in 2.4a3. PEP: 318 Title: Decorators for Functions and...
18
by: John M. Gabriele | last post by:
I've done some C++ and Java in the past, and have recently learned a fair amount of Python. One thing I still really don't get though is the difference between class methods and instance methods. I...
0
by: Leslaw Bieniasz | last post by:
Cracow, 16.09.2004 Hi, I have a problem with compiling the following construction involving cross-calls of class template methods, with additional inheritance. I want to have three class...
3
by: Alan Mok | last post by:
Hi All, I am a newbie to dotfuscator. I am trying to dotfuscate my application. Everything seems ok except that when I try to run a method that has the following command ...
6
by: seeIT | last post by:
In a client application a simple webservice (add/multiply) was added to solution panel but proxy methods do not appear. WSDL description in solution panel follows: <?xml version="1.0"...
12
by: Andrew Poulos | last post by:
With the following code I can't understand why this.num keeps incrementing each time I create a new instance of Foo. For each instance I'm expecting this.num to alert as 1 but keeps incrementing. ...
11
by: s99999999s2003 | last post by:
hi which is the best methods to use for list copying. using list() , or create list through list comprehension. what are the differences between these ? thanks
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.