SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Member
    Join Date
    Jul 2013
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Automatic Update the Pages

    Hi!

    I have a news website which I need to update everyday. But whenever I want to change the layout of the website I need to change the layout of every pages (which is not possible as there are many pages in a news websites).

    Can anyone tell me a method or name any software which would help me to change the layout as my wish. And after changing the layout, all the pages also changes the layout automatically (without changing the main content or news area, because it is the single thing which is different in every page).

    And I am using HTML and Css just for your reference.

    I am helpless. Please help me.

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,182
    Mentioned
    191 Post(s)
    Tagged
    2 Thread(s)
    You forgot to specify which CMS you're using.

  3. #3
    SitePoint Member
    Join Date
    Jul 2013
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am not using any CMS just HTML and CSS.
    But again I have no knowledge about using CMS with HTML and CSS to update a website...

    Plz help me ....

  4. #4
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,182
    Mentioned
    191 Post(s)
    Tagged
    2 Thread(s)
    Sorry, you posted this in the "WordPress CMS" forum so I figured you were. (now moved)

    Having consistant pages usually involves templates or at least include()

    Is this a PHP site? If purely HTML then I'm afraid it's multiple file edits.

  5. #5
    Non-Member
    Join Date
    Jul 2013
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Even if its HTML extensions you can use php includes by placing a single line in your htaccess. But to answer your question you need to place all the common elements of all your pages in php includes. This way when you edit the include it will populate to all the pages.

  6. #6
    SitePoint Member
    Join Date
    Jul 2010
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    An alternative to Jezabel's is to use Dreamweaver (or any other web design software that supports templates). In Dreamweaver specifically, you are able to create templates, add editable regions within the template, and then and then base each page of your site off the template.

    When you change the template, Dreamweaver changes all the files on the site automagically - and you just have to reupload all your HTML

    But Jezabel's solution is really much cleaner and less reliant on a piece of software, if your server supports my kind of server side language (probably 99.9% of commercial web hosting servers do!).

  7. #7
    SitePoint Enthusiast
    Join Date
    Sep 2013
    Location
    UK
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Jezabel View Post
    Even if its HTML extensions you can use php includes by placing a single line in your htaccess. But to answer your question you need to place all the common elements of all your pages in php includes. This way when you edit the include it will populate to all the pages.
    I have a simiar problem.

    Firstly a bit of background about my level of abiliy. I'm self-taught at HTML, got my head around that and CSS and have been able to create a website from scratch by just typing code. However PHP is something new to me, I'm a novice at scrpting, so I'm not looking for anything too complicated.

    I manage a site with a number of pages, each page is unique, but shares some identical elements, such as the header, menu, footer and a few other bits. The site is all hand written by myself in HTML. But, for example, if I want to add a page and then add it to the menu, I have to edit the menu section for every page.
    I am lead to believe the with PHP you can make this process easier and only need to make the edit to common site elements once. But I do not know the best way to achieve this. I have been experimenting and, with my limited PHP knowledge came up with a way that works to an extent. But there are one or two things I can't get to work, and I'm not sure if this way is best practice or the most efficient way to do this, since I couldn't find an on-line "how to" and just made this up from stuff I could find in PHP tutorials. So I would like some expert adivce on this.

    What I did was this: I saved a HTML page as PHP. Where there was a common element such as the menu, I replaced it with some PHP which Opens, Reads and Echos a file which contains the code for the menu. If I replace the menu on all pages, I only need to edit the one file with the menu code, and all pages see the same change. It works, but is this the best way?
    One thing I could not get to work was each page's unique header image. The pages all start like this, an identical header, a unique header image, then idential menu, followed by unique content, finishing with an identical footer.
    I thought I could put the first part (header, header image and menu) into one common file for all pages, and set a unique string on each page to set the name of the unique header image, then put that string in the code in the common file, but I can't get it to work.
    Can anyone advise?

  8. #8
    SitePoint Enthusiast
    Join Date
    Sep 2013
    Location
    UK
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Making some progress now.
    When I posted before I had no idea what PHP Includes were, but thought I should find out.
    After a search I found this thread which links to this page. It seems what I was trying was not a million miles away from how includes work, a separate file referenced by the page. But includes look like the proper way to do it, which is what I was looking for. Also using this method, saving the includes as PHP files, my problem with the unique header image is solved, it works with PHP includes.
    Another thing to mention, for anyone wondering how to do it. In my menu, each page had it's own link with an ID set to "current" (as defined in the CSS file) so it renders a different colour and doesn't highlight on hover like all the other links.
    But with the shared menu, this won't work. So what I did was give each menu item an unique ID, then set the style of the page's own ID in the page it's self, and removed current from the CSS file. It could maybe be done better, so I keep current in the CSS (for universal editing) and put something in the page that says "current = pageID", but not sure how to do that yet.

    Another question.
    If my site currently has a load of pages with HTML extesions, index.html events.html about.html etc, which are indexed with Google, Bing and suchlike, and linked to by other sites. Then I change them for PHP extensions, index.php events.php about.php etc. Do I then have to write a whole load of 301's in my htaccess? Or is there a quicker way to maybe set it to redirect any html to php with the same filename?

  9. #9
    SitePoint Enthusiast
    Join Date
    Sep 2013
    Location
    UK
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by SamA74 View Post
    If my site currently has a load of pages with HTML extesions, index.html events.html about.html etc, which are indexed with Google, Bing and suchlike, and linked to by other sites. Then I change them for PHP extensions, index.php events.php about.php etc. Do I then have to write a whole load of 301's in my htaccess? Or is there a quicker way to maybe set it to redirect any html to php with the same filename?
    Answering my own questions again, you guys are slow.
    For the benefit of anyone else looking for this, to redirect all HTML pages to PHP put this in the htaccess.
    Code:
    RedirectMatch 301 (.*)\.html$ http://www.example.com$1.php


Tags for this Thread

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
  •