Professional Web Applications Themes

PHP Includes - PHP Development

Hello, I am looking at converting my webpage to use php includes to save time in updating the site. I would like to setup a template for the design and use a php include to add the content into the page. I was looking at something like: www.domain.com/index.php?page.php or www.domain.com/index.php?news/newspage.php So the first url would include the content from page.php within say a table in index.php And the second would include the content from newspage.php. The content would always be in the same place on the index page so is there is a php include i could use that would ...

  1. #1

    Default PHP Includes

    Hello,

    I am looking at converting my webpage to use php includes to save time in
    updating the site. I would like to setup a template for the design and use a
    php include to add the content into the page.

    I was looking at something like:

    www.domain.com/index.php?page.php
    or
    www.domain.com/index.php?news/newspage.php

    So the first url would include the content from page.php within say a table
    in index.php
    And the second would include the content from newspage.php.

    The content would always be in the same place on the index page so is there
    is a php include i could use that would achieve this?

    thanks, Jonathan


    Jonathan Guest

  2. #2

    Default Re: PHP Includes

    Jonathan Davis wrote: 


    First of all you shouldn't do it that way, because of security.
    Better use something like www.domain.com/index.php?page=11111

    where you can determine what page with 11111 is meant.

    in index.php

    $page_array=array('11111'=>'page.php');

    include($page_array[$_REQUEST['page']]);


    But note that isn't the right way anyway, at least you have to check
    whether the requested page is available.
    You also could use a real template system like smarty or try to
    implement one for your own.
     

    Regards
    Stefan
     
    Stefan Guest

  3. #3

    Default Re: PHP Includes

    "Stefan Rybacki" <net> wrote in message
    news:net... [/ref]

    Thanks for that Stefan, I was thinking there would be a big security risk
    doing it that way.
    I have setup a test of this and it seems to work fine.

    Unfortunately with the way my site is setup, in order to get the whole site
    done this would involve setting up a folder with every file in it (around
    2000 files), and also having to rename most of them and rewrite a lot of
    code....

    I think an easier solution might be to include a index.php and a content.php
    file in each subfolder (instead of just a index.php - which at the moment i
    am having to manually redesign) so when i wanted to redesign the site i
    could just create a single new index.php and paste it into all 30 folders so
    i would not have to redesign all the content pages every time as the content
    does not change.

    www.classickidstv.co.uk is the site if anyone wants to check it out and see
    if there is a better solution.

    thanks for your response, Jonathan


    Jonathan Guest

  4. #4

    Default Re: PHP Includes

    Take a look at phpCMS

    This is a templating system that

    a) Leaves existing files alone so you can install and convert file by
    file.
    b) Maps urls to hide the fact that it is a php script, so search engines
    to index the pages.
    c) Works easily on sites with php. It needs no database.
    d) It is GPL. (Free download).
    e) It is easy to set up.

    In message <Byxxe.13194$ntli.net>, Jonathan Davis
    <com> writes
     [/ref]
    >
    >
    >Unfortunately with the way my site is setup, in order to get the whole site
    >done this would involve setting up a folder with every file in it (around
    >2000 files), and also having to rename most of them and rewrite a lot of
    >code....
    >
    >I think an easier solution might be to include a index.php and a content.php
    >file in each subfolder (instead of just a index.php - which at the moment i
    >am having to manually redesign) so when i wanted to redesign the site i
    >could just create a single new index.php and paste it into all 30 folders so
    >i would not have to redesign all the content pages every time as the content
    >does not change.
    >[/ref]
    In phpCSM you point each data file (index.htm, or whatever.htm) to a
    format file. So updating the format is one file change (per layout -
    you can have several).

    By using sub-templates, you can update sub-areas on many layouts
    (adverts?) by uploading one file.

    Regards

    Ian

    --
    Ian - posting to a Newsgroup. Please remove everything to reply.
    Ian Guest

  5. #5

    Default Re: PHP Includes

    Jonathan Davis wrote: 
    >
    > Thanks for that Stefan, I was thinking there would be a big security risk
    > doing it that way.
    > I have setup a test of this and it seems to work fine.
    >
    > Unfortunately with the way my site is setup, in order to get the whole site
    > done this would involve setting up a folder with every file in it (around
    > 2000 files), and also having to rename most of them and rewrite a lot of
    > code....
    >
    > I think an easier solution might be to include a index.php and a content.php
    > file in each subfolder (instead of just a index.php - which at the moment i
    > am having to manually redesign) so when i wanted to redesign the site i
    > could just create a single new index.php and paste it into all 30 folders so
    > i would not have to redesign all the content pages every time as the content
    > does not change.
    >
    > www.classickidstv.co.uk is the site if anyone wants to check it out and see
    > if there is a better solution.
    >
    > thanks for your response, Jonathan
    >
    >[/ref]
    There isn't really a security risk unless somone visiting the url
    directly is an enourmously bad thing, in that case there's an easy way
    to fix it: put all the included php files in another directory, unless
    the intruder knows that directory name they wont be able to access the
    files directly.
    Exyle Guest

  6. #6

    Default Re: PHP Includes

    I looked at your site, and I have a few ideas for you.

    But have you already done all of your file naming conventions? In
    other words,, some of my ideas would take your url

    http://www.classickidstv.co.uk/ripleyandscuff/

    and change it to http://www.classickidstv.co.uk/ripley_and_scuff/

    That's ripley_and_scuff with underscores.

    Interested?



    AF Guest

Similar Threads

  1. PHP Includes
    By Tobias G in forum PHP Programming
    Replies: 20
    Last Post: March 5th, 07:57 AM
  2. PHP includes in DW Mx
    By mazzy-star in forum Macromedia Dynamic HTML
    Replies: 1
    Last Post: October 5th, 09:45 PM
  3. includes and ASP
    By Trevor in forum ASP
    Replies: 1
    Last Post: August 25th, 12:40 PM
  4. Includes Ugh...
    By Paul Woods in forum ASP
    Replies: 0
    Last Post: August 22nd, 06:55 PM
  5. Includes...
    By Curt_C [MVP] in forum ASP
    Replies: 0
    Last Post: August 20th, 10:30 PM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139