prm_cosmo — 2013-07-15T03:01:16-04:00 — #1
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.
mittineague — 2013-07-15T14:02:46-04:00 — #2
You forgot to specify which CMS you're using.
prm_cosmo — 2013-07-16T00:46:01-04:00 — #3
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 ....
mittineague — 2013-07-16T02:02:06-04:00 — #4
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.
system — 2013-07-16T09:10:00-04:00 — #5
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.
tankianann — 2013-07-25T13:19:46-04:00 — #6
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!).
sama74 — 2013-09-07T14:22:21-04:00 — #7
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?
sama74 — 2013-09-10T15:13:57-04:00 — #8
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 [URL="http://pageaffairs.com/notebook/enhance-your-site-with-php-includes"]this page](http://www.sitepoint.com/forums/showthread.php?791728-thoughts-on-using-includes-in-web-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.
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?
sama74 — 2013-09-12T14:28:56-04:00 — #9
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.
RedirectMatch 301 (.*)\\.html$ http://www.example.com$1.php