including content

This is a discussion on including content within the alt.comp.lang.php forums, part of the PHP Programming Forums category; I got a website consisting of about 150 php pages. The site uses a frameless table based design. Header and ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-03-2006
Martin Mücke
 
Posts: n/a
Default including content

I got a website consisting of about 150 php pages.
The site uses a frameless table based design.
Header and menu are always the same and therefore should be extracted.
At the moment I got a "frame" (not a real html frame, more like
"framework"), that contains my menu and header content.
In this php page I dynamically include all content pages.
Downsides: All pages got the same meta tags.
Now I am looking for a better solution. I considered to
do it "upside down" by including the menu and header content into
the content pages instead - this way each page could have their own meta
tags. Problem: Depending on the directory depth, the path to the menu
and header pages to includes always varies. Absolute paths don't seem to
work with the php include command.
What would you suggest me to do, and are there any automatical tools
that could easily do the job for me?

I've heard of a tool that creates "static" pages by "physically"
including all contents into a page
The link to that tool was:
http://gentoo-portage.com/browse-pro...p?program=1064

Unfortunatelly, the link is broken.

So in conlusion:

- What would you suggest me to do to get individual meta tags for each
page as fast and easy as possible?

- Do you maybe know a tool that could help here?

Thanks,

Martin
Reply With Quote
  #2 (permalink)  
Old 10-03-2006
Arjen
 
Posts: n/a
Default Re: including content

Martin Mücke schreef:
> I got a website consisting of about 150 php pages.
> The site uses a frameless table based design.
> Header and menu are always the same and therefore should be extracted.
> At the moment I got a "frame" (not a real html frame, more like
> "framework"), that contains my menu and header content.
> In this php page I dynamically include all content pages.


Then why not dynamically generate meta tags as well or retrieve them
from your page to include ?
preg_match_all('/<[s]*meta[s]*name="?' . '([^>"]*)"?[s]*' .
'content="?([^>"]*)"?[s]*[/]?[s]*>/si', $this->html, $this->mnm);

> I've heard of a tool that creates "static" pages by "physically"
> including all contents into a page
> The link to that tool was:
> http://gentoo-portage.com/browse-pro...p?program=1064


wget does that as well iirc

Arjen
Reply With Quote
  #3 (permalink)  
Old 10-03-2006
.:[ ikciu ]:.
 
Posts: n/a
Default Re: including content

Zebrawszy mysli Martin Mücke <MartinMuecke@gmx.de> wyklepal:
> - What would you suggest me to do to get individual meta tags for each
> page as fast and easy as possible?


use db to store pages
text for body
text (varchar2) for keywords
text for description

make function which will show header with your unique metadata

or make it on files - same idea

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ikciu | gg: 718845 | www: www.e-irsa.pl

2be || !2be $this => mysql_query();


Reply With Quote
  #4 (permalink)  
Old 10-03-2006
Martin Mücke
 
Posts: n/a
Default Re: including content

Well I don't want one entry for every page,
this is just too much, too slow, imho.
Reply With Quote
  #5 (permalink)  
Old 10-03-2006
Martin Mücke
 
Posts: n/a
Default Re: including content

> preg_match_all('/<[s]*meta[s]*name="?' . '([^>"]*)"?[s]*' .
> 'content="?([^>"]*)"?[s]*[/]?[s]*>/si', $this->html, $this->mnm);


What does this command do? Parse an entire page,
search for meta tags and extract them into variables??
I guess this will cost a LOT of speed...
:-(


>> I've heard of a tool that creates "static" pages by "physically"
>> including all contents into a page
>> The link to that tool was:
>> http://gentoo-portage.com/browse-pro...p?program=1064

>



> wget does that as well iirc


From what I read, wget mirrors a remote http site to hard drive -
so in the end I would have html content, not php.
Reply With Quote
  #6 (permalink)  
Old 10-03-2006
.:[ ikciu ]:.
 
Posts: n/a
Default Re: including content

Zebrawszy mysli Martin Mücke <MartinMuecke@gmx.de> wyklepal:
> Well I don't want one entry for every page,
> this is just too much, too slow, imho.


Then use other table in db where you will store keywords and descriptions
and use same metadata for few pages (stored in db too)


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ikciu | gg: 718845 | www: www.e-irsa.pl

2be || !2be $this => mysql_query();


Reply With Quote
  #7 (permalink)  
Old 10-04-2006
Arjen
 
Posts: n/a
Default Re: including content

Martin Mücke schreef:
>> preg_match_all('/<[s]*meta[s]*name="?' . '([^>"]*)"?[s]*' .
>> 'content="?([^>"]*)"?[s]*[/]?[s]*>/si', $this->html, $this->mnm);

>
> What does this command do? Parse an entire page,
> search for meta tags and extract them into variables??
> I guess this will cost a LOT of speed...
> :-(


Wow you're really negative.

Did you even try it ? I bet you didn't. I count to 1000 pages in a
fraction of a second on my server.

You could allways generate the meta tags in any other way.
Best way to do this is to store them in a db.

A little more work but faster

>
>>> I've heard of a tool that creates "static" pages by "physically"
>>> including all contents into a page
>>> The link to that tool was:
>>> http://gentoo-portage.com/browse-pro...p?program=1064


>
>> wget does that as well iirc

>
> From what I read, wget mirrors a remote http site to hard drive -
> so in the end I would have html content, not php.


That would be a good choice if you want to create static pages ! Unless
offcourse you dont want to create static pages. In that case u need to
clarify ur question

Arjen
Reply With Quote
  #8 (permalink)  
Old 10-05-2006
Colin McKinnon
 
Posts: n/a
Default Re: including content

Martin Mücke wrote:

> In this php page I dynamically include all content pages.
> Downsides: All pages got the same meta tags.
> Now I am looking for a better solution. I considered to
> do it "upside down" by including the menu and header content into
> the content pages instead - this way each page could have their own meta
> tags.


Exactly what I was going to suggest.

> Problem: Depending on the directory depth, the path to the menu
> and header pages to includes always varies. Absolute paths don't seem to
> work with the php include command.


Strange - I've never had a problem with absolute paths. But for an include
file which is globally available - I'd keep it in a seperate dir listed in
the include_path (thats what the include_path is for).


C.
Reply With Quote
  #9 (permalink)  
Old 10-05-2006
PleegWat
 
Posts: n/a
Default Re: including content

In article <GzcVg.2240$pa.725@newsfe2-gui.ntli.net>, Colin McKinnon
says...
> Martin Mücke wrote:
>
> > In this php page I dynamically include all content pages.
> > Downsides: All pages got the same meta tags.
> > Now I am looking for a better solution. I considered to
> > do it "upside down" by including the menu and header content into
> > the content pages instead - this way each page could have their own meta
> > tags.

>
> Exactly what I was going to suggest.
>
> > Problem: Depending on the directory depth, the path to the menu
> > and header pages to includes always varies. Absolute paths don't seem to
> > work with the php include command.

>
> Strange - I've never had a problem with absolute paths. But for an include
> file which is globally available - I'd keep it in a seperate dir listed in
> the include_path (thats what the include_path is for).


You are using a filesystem path right? I'm not sure, but I think most
PHP configuration don't allow includes using URL paths (relevant to the
site root)
--
PleegWat
Remove caps to reply
Reply With Quote
  #10 (permalink)  
Old 10-06-2006
ZabMilenko
 
Posts: n/a
Default Re: including content



PleegWat wrote:
> You are using a filesystem path right? I'm not sure, but I think most
> PHP configuration don't allow includes using URL paths (relevant to the
> site root)



Thus quoteth "http://us3.php.net/include/":

{{ If "URL fopen wrappers" are enabled in PHP (which they are in the default
configuration), you can specify the file to be included using a URL (via
HTTP or other supported wrapper - see Appendix M for a list of protocols)
instead of a local pathname. If the target server interprets the target file
as PHP code, variables may be passed to the included file using a URL
request string as used with HTTP GET. This is not strictly speaking the same
thing as including the file and having it inherit the parent file's variable
scope; the script is actually being run on the remote server and the result
is then being included into the local script. }}



You can't read the source of the target script, but the target can produce
php code that is readable and include-able using include:

<?php
echo "<?php \n\n";
echo " print_r($GLOBALS);\n\n";
echo "?>";
?>

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:47 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0