PDA

View Full Version : How to force orphans to load if loaded seperately?



student101
04-29-2008, 09:15 AM
1) Script Title:
Dynamic Ajax Content

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm#combo

3) Describe problem:
There is a main page: (with all the <body> and <html> tags)
index.php
Orphaned or linked pages: (with no <body> or <html> tags)
links.php
home.php
contact.php
etc...
If I load one of the orphaned or linked pages they don't show with the main page
ie: they only show the div and not the heading, logo and so on.

How to force the orphans or linked pages to load with the main page?

Cheers

ddadmin
04-30-2008, 07:56 AM
You can add a JavaScript inside these orphan pages that redirects users to index.php if they are being viewed as standalone pages, though that won't cause index.php to load the orphan page unfortunately. There's no quick way to do the later unfortunately. For the former, a script like the below added to your orphan pages would be the idea:


<script type="text/javascript">

if (!/index\.php/i.test(location.href)) //if current page isn't index.php
location.replace("index.php")

</script>

student101
04-30-2008, 08:02 AM
Cool

I have tried this method:
top of index.php page:

window.onload = function(){
if(location.search.indexOf('uri=')>-1){
var loc = location.search.split('=');
ajaxpage('/'+loc[1]+"","rightcolumn");
}
}
Top of the orphan pages:

if(location.href.indexOf("")>-1){
location.href='index.php?uri=home.php';
}

It works but the uri (URL) is displayed like this: index.php?uri=home.php when loading one of the orphan pages.

Cheers

ddadmin
05-01-2008, 02:01 AM
That should work, yes, or are you asking a question?

student101
05-01-2008, 03:46 AM
No,
It's the only way I could get it to work.

If it's possible to fix the uri (URL) to only display index.php then cool, otherwise it's no trainsmash

Cheers and thanks.