1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Development PHP question

Discussion in 'Software' started by death_star, 7 Oct 2003.

  1. death_star

    death_star What's a Dremel?

    Joined:
    14 Jul 2003
    Posts:
    527
    Likes Received:
    0
    It can be done, they do it in phpbb forums i think. Anywho my question is if my entire website is gonna be PHP how can I make it so that if i edit my index (Example: A menu bar) it will change it auto maticcly on all my other ones (reviews.php articles.php guides.php ect.)
     
  2. Alaric

    Alaric code assassin

    Joined:
    3 Nov 2001
    Posts:
    2,881
    Likes Received:
    0
    not sure if i'm totally understanding the way you phrased the question, but it seems the simple answer is to get them all from the same source.

    i presume you're thinking of something like:
    PHP:
    include("header.html");
    //content goes here
    include("footer.html");
    there are of course much nicer ways to make CMSs

    Alaric.
     
  3. death_star

    death_star What's a Dremel?

    Joined:
    14 Jul 2003
    Posts:
    527
    Likes Received:
    0
    Ya mean, <?php incude(menu.php); > ? Thats what I had thought of origionly.
     
  4. Alaric

    Alaric code assassin

    Joined:
    3 Nov 2001
    Posts:
    2,881
    Likes Received:
    0
    that would be one way of doing it...
    I'm slightly concerned at the simplicity of the question - you can't have done any php before if you're asking this :)

    gl

    Alaric.
     
  5. death_star

    death_star What's a Dremel?

    Joined:
    14 Jul 2003
    Posts:
    527
    Likes Received:
    0
    I've used it a little and starting to get the hang of it so im doing my entire website in php and just wanted to speed things up.
     
  6. death_star

    death_star What's a Dremel?

    Joined:
    14 Jul 2003
    Posts:
    527
    Likes Received:
    0
  7. bello

    bello What's a Dremel?

    Joined:
    17 Sep 2002
    Posts:
    80
    Likes Received:
    0
    If you are going to use include() i recommend you use @include_once(); instead.

    Mor e info

    Cheers,
     
  8. death_star

    death_star What's a Dremel?

    Joined:
    14 Jul 2003
    Posts:
    527
    Likes Received:
    0
  9. OneSeventeen

    OneSeventeen Oooh Shiny!

    Joined:
    3 Apr 2002
    Posts:
    3,454
    Likes Received:
    2
    You'll have to save the files as .txt files if you want someone to view the source code (I could be wrong, I'm new at PHP as well)

    save the files as "source-[filename].txt" or something like that, then upload it, let someone take a look and help you out, then take them down again.

    I'd be glad to help once I can access the code.
     
  10. Hwulex

    Hwulex What's a Dremel?

    Joined:
    1 Feb 2002
    Posts:
    4,007
    Likes Received:
    1
    If you want to show people source code, you can use a page like this:

    PHP:
    <?php

    // Source Code Viewing Script v1.5 by Hwulex
    // 14/01/2003
    // Xaprief.com

    echo "<html>\n<head>\n\t<title>Source Code Viewer</title>\n</head>\n<body>
    \n<form name=\"viewsource\" method=\"GET\" action=\"
    $_SERVER[PHP_SELF]\">\n<select name=\"source\">";

    $path="./";
    $types = array('php','css','js','html');
    $handle opendir($path);

    while (
    false !== ($file readdir($handle))) {
        if (
    $file != "." && $file != "..") {
            foreach (
    $types as $current) {
                if ((
    strtolower(end(explode(".",$file)))) == $current) {
                    if (
    $file==$_GET[source])
                        
    $selected="selected";
                    else
                        
    $selected="";
                    echo
    "\n\t<option value=\"$file\" $selected>$file</option>";
                } 
    # current
            
    # for each
        
    # file
    # while

    closedir($handle);

    echo 
    "\n</select>\n<input type=\"submit\" name=\"submit\" value=\"Go\">\n<br><br>\n\n";

    if (
    $_GET[source])
        
    show_source("$_GET[source]");

    echo 
    "\n\n</body>\n</html>\n";

    ?>
    Maybe not the tidiest thing ever, but does the job. :)

    Save as a php file and upload to your space. Remember to (a) password protect it or (b) delete it when not required. It will allow people to view the full source if every type of file specified in the $types array.
     
  11. death_star

    death_star What's a Dremel?

    Joined:
    14 Jul 2003
    Posts:
    527
    Likes Received:
    0

Share This Page