hmm but isnt it possible to call from music folder just the index and view as mydomain.com/index.php?view=music and it will bring up the music index? insted of showing as

mydomain.com/index.php?view=/music/index.php?

n btw take a look at..

    I'm about to go eat supper. It looks as though my code is buggy and contains errors.

    hmm but isnt it possible to call from music folder just the index and view as mydomain.com/index.php?view=music and it will bring up the music index? insted of showing as

    mydomain.com/index.php?view=/music/index.php?

    That could easily be done using an entirely different, simpler approach. Is this what you've wanted all along? Is this all you're going to be using the script for? I.E. hard-coding different page ID's "music,list,rules,help" etc. into the PHP script and telling it where to go for each? If so, please let me know.

      yes 🙂 and i want to add both this and the other script together 🙂 by the way let's do one thing at a time shall we? lets get over with umm the skin selection things first and we will get back here after we are done with that 🙂? if thats ok with u....

        Alrighty. Sorry -- I usually try to keep a few threads active as my workload, I can imagine on the receiving end it might get a bit confusing/tiresome switching back and forth 😛

        When we return to this issue, tell me this: for the ones you wish to hard-code, could we use a different variable? I.E. if you want the script to literally open a file from a path you give it, keep using the "?view=test,test3", BUT if you want to use keywords that you set up, use a variable such as "?id=music" etc.?

          ya just like the other one...except this time..use link up...not drop down 😛 🙂 ...call up from dir with that path 😃

            This script will be a lot like the last one I just wrote...

            <?PHP
            $view = ((@$_GET['view']) ? $_GET['view'] : '');
            
            switch($view) {
            
            // NOTE: I did the first one 'music' as an example.
            // YOu can copy and paste one of the 'case's and change what's in the quotes to suit your needs.
            
            case "music":
            
            	require_once('/music/index.php');
            	break;
            
            case "chat":
            
            	require_once('/chat/index.php');
            	break;
            
            default:
            	// in here, put what page to load if $view doesn't match one of the ones above
            	break;
            }
            ?>

            EDIT: There was an error in the above code, but it has been corrected.

              hey, can you help me to put this n the other one together? so i can use them both in index.php? cuz im unable to do so ryte now 🙁 so if u can help me out ok. thanks in advanced!

                I'm not understanding what you're asking.

                What other one, you mean the "?view=" where it loaded the file from the path you specified?

                  opse forgot to mention...you know the skin based on url? i want this and the skin based on url scripts code to be added together so i can use them both in my index.php? get it now? thanks 🙂

                    Wouldn't you simply copy and paste the contents of one script into the other?

                      i put them but it gives me error 🙁

                        7 days later

                        Originally posted by bradgrafelman
                        Assuming you've put all your scripts in a folder called "content" that is in the same location of the script, i.e.:

                        /your/path/here/index.php?view=rules
                        /your/path/here/content/rules.php

                        and so on, then you can use the following code:

                        <?PHP
                        $param = 'view'; // This is the "?view=" part. change to suit your needs
                        
                        $path = 'content/'; // Path relative to current script to look for includes.
                                            // NOTE: Must have trailing slash 'path/to/scripts/', etc.
                                            // NOTE: If scripts are in current directory, use $path = '';
                        
                        if(!empty($_GET[$param])) {
                        
                        if(eregi(',', $_GET[$param])) { 
                        
                        	$files = explode(",", $_GET[$param]);
                        
                        	foreach($files as $filename) {
                        		if(dirname(realpath($path.$filename.'.php')) == realpath(dirname($_SERVER['PATH_TRANSLATED']) . '/' . rtrim($path, '/'))) include_once($path.$filename.'.php');	
                        	}
                        
                        } else if(dirname(realpath($path.$_GET[$param].'.php')) == realpath(dirname($_SERVER['PATH_TRANSLATED']) . '/' . rtrim($path, '/'))) include_once($path.$_GET[$param].'.php');
                        
                        } else {
                        
                        // This is where you would tell the script what to do if there is no "?view="
                        
                        }
                        ?>

                        With this script, you can either use "?view=rules" and it will inclue "content/rules.php", or you can use multiple scripts separated by a comma, i.e. "?view=header,rules,footer" and it will call each, in the order given.

                        NOTE: This script has been tested. If you have any problems or questions, feel free to reply. [/B]

                        There is a problem with this 🙁 it calls two index...the main index and the sub index.. as well 🙁 ... so what to do?

                          Before the "} else {" statement, kill the script (use "exit;" or "die();").

                            Write a Reply...