Results 1 to 5 of 5

Thread: How to force orphans to load if loaded seperately?

  1. #1
    Join Date
    Feb 2008
    Posts
    137
    Thanks
    18
    Thanked 2 Times in 2 Posts

    Question How to force orphans to load if loaded seperately?

    1) Script Title:
    Dynamic Ajax Content

    2) Script URL (on DD):
    http://www.dynamicdrive.com/dynamici...tent.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
    Last edited by student101; 04-29-2008 at 09:52 AM.

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    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:

    Code:
    <script type="text/javascript">
    
    if (!/index\.php/i.test(location.href)) //if current page isn't index.php
    	location.replace("index.php")
    
    </script>

  3. #3
    Join Date
    Feb 2008
    Posts
    137
    Thanks
    18
    Thanked 2 Times in 2 Posts

    Default

    Cool

    I have tried this method:
    top of index.php page:
    Code:
    window.onload = function(){
        if(location.search.indexOf('uri=')>-1){
            var loc = location.search.split('=');
            ajaxpage('/'+loc[1]+"","rightcolumn");
        }
    }
    Top of the orphan pages:
    Code:
    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

  4. #4
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    That should work, yes, or are you asking a question?

  5. #5
    Join Date
    Feb 2008
    Posts
    137
    Thanks
    18
    Thanked 2 Times in 2 Posts

    Default

    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •