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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
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(); |
|
|||
|
> 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. |
|
|||
|
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(); |
|
|||
|
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 |
|
|||
|
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. |
|
|||
|
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 |
|
|||
|
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 "?>"; ?> |