Click to See Complete Forum and Search --> : Google search string for this phenomenon?


Frank62
02-14-2008, 05:00 AM
Hi,

In case Google locates a certain article on this website, and one clicks it, the article appears in the full context (the full layout). How is that done, with PHP? I know how it can be done with PHP+JS in case the articles would have been 'stand-alone' files on the server, and would have to be loaded into a framed page. But I wonder how it is done in case of database-stored files, with PHP. Is there some kind of PHP line at the top of the database-stored file that says "this page only in that layout"?

I tried to locate some tutorials on this matters, but seemingly I'm not using the right keywords. I'm getting tons of hits, but the first 10 contained everything but the girl, if you know what I mean.

What would be a good Google search string to locate such tutorials? Or does anyone know where a good tut is to be found? Obviously, a clear explanation is welcomed, too. (I'm a beginner at PHP, all I can do without errors is include content, and the above-mentioned PHP+JS trick.)

It's not a matter of urgency but I would like to know how it's done.

Thanks in advance.

TheRave
02-14-2008, 07:30 AM
Either:

Make included "content" files unaccessible directly both from google and the user (recommended). This means the content files can only be accessible through a template.

Or

Make the content files include the template files if not already included.
include_once();
require_once();

Frank62
02-14-2008, 10:52 AM
Thanks, David.

I guess the through-a-template-only method is achieved through configuring the server?

TheRave
02-15-2008, 03:06 AM
You can make them inaccessible either by just moving the files out of the wwwroot. Or you can use .htaccess to restrict/remove access to any file(s) or folder(s).

The .htaccess is a form of configuration but doesn't require access to major config files.

Frank62
02-15-2008, 03:25 AM
Thanks again.

I would choose for the second option then, the 'require method'.

By chance, we need to apply this method in a 'live' case where I helped a guy out with CSS positioning problems: http://www.webdeveloper.com/forum/showthread.php?t=173618. He wanted to php-include content as well, so I set that up for him, too. By I don't know how exactly to have the child files always displayed in the parent page in this case. I know exctly how it is done with (real) iframes, but not in his case.

Would it be sufficient in his case to put this line at the top of all 'bare' child files: <?php require(index.php)?>? It seems not, to me, but could you help him out with the details?