Old 04-04-2005   #1 (permalink)
Sheep Worrier
 
Man1c M0g's Avatar
 
Join Date: Sep 2003
Location: Portsmouth, UK.
Posts: 4,073
Blog Entries: 14

Send a message via ICQ to Man1c M0g Send a message via MSN to Man1c M0g Send a message via Skype™ to Man1c M0g
Chicken & The Egg Problem!

I have hit a distinct logical snag when coding a new version of the main index, so I thought i'd approach you guys to see if I can find a solution...

As many of you know, the main biorust website runs on a simple include system. The main index.php has holes in specific bits which it fills with relevant content from tutorials.php, etc, as appropriate. All the relevant PHP instructions for each subsection are stored in its respective page (i.e. all the PHP code for showing a tutorials content is stored in tutorial_detail.php, etc). The main problem with this system is that I can't think of a way to make the HTML title in the main index.php dynamic. Since all dynamic PHP code is executed AFTER the HTML title tags it prevents dynamic action, and the problem becomes akin to something like the chicken and the egg. I know I can rewrite the entire system to overcome this little limitation, but its like cracking a walnut with a sledgehammer. Does anyone have a simple and elegant solution?
__________________
Man1c M0g is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 04-05-2005   #2 (permalink)
code anyone?
 
scrowler's Avatar
 
Join Date: Feb 2004
Location: New Zealand
Posts: 590

Send a message via MSN to scrowler Send a message via Skype™ to scrowler
sort through the code until you find the part that actually outputs the HTML, and modify it?

i did it earlier today on some phpBB code to make me an admin and still show up as a regular user, works a treat.
__________________
BioRUST Tutorials - the birthplace
scrowler is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 04-05-2005   #3 (permalink)
Moderator
 
Join Date: Jul 2004
Location: Quebec City, Canada
Posts: 50

From what I remember of the Biorust scripts, there does not appear to be an easy way out.

But wait a minute... if you can afford to do the logic twice, then there might be something. Just make your specialized scripts (those that get included) so that they can be included twice while doing two different things. That way, things do not get overly complicated and yet you still achieve a decent result.

I don't feel like explaining any further, so here is an example of what I'm talking about.

index.php:

PHP Code:
<?php

    
    
function page_code() {

        switch(
$_GET['page']) {

            case 
'xyz':

                require 
'./page_xyz.php';

            break;

            default:

                require 
'./page_index.php';

            break;

        }

    }

    
    
?>

<html>
    <head>
        <title>[BioRUST] :: <?php page_code(); ?></title>
    </head>
    <body>
        <?php

            define
('IN_BODY''');

            
page_code();

        
?>
    </body>
</html>

page_xyz.php:

PHP Code:
<?php

    
if(!defined('IN_BODY'))

        echo 
'Page XYZ\'s Title';

    else {

        
?>

        <!-- Your content here -->

        <?php

    
}

?>
So basically, you would put that code in the first file where the title known for sure, be it page_xyz.php or tutorial_85.php


Hope you can achieve something useful out of this.
The Eagle is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 04-05-2005   #4 (permalink)
Sheep Worrier
 
Man1c M0g's Avatar
 
Join Date: Sep 2003
Location: Portsmouth, UK.
Posts: 4,073
Blog Entries: 14

Send a message via ICQ to Man1c M0g Send a message via MSN to Man1c M0g Send a message via Skype™ to Man1c M0g
LOL! thanks Eagle - that is a very easy solution too! I'll hopefully have it up and working in the next week...
__________________
Man1c M0g is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread

Thread Tools
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 On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT +1. The time now is 07:20 PM.
Content Relevant URLs by vBSEO 3.2.0

Design & Content © BioRUST 2007 :: PRIVACY STATEMENT :: LEGAL INFORMATION :: ADVERTISING MEDIA KIT