I have a section on my site in every page that has 'recent posts' and have just realised that i may have to update my static html pages to change the recent posts as with blogger or word press it changes automatically. Is there anyway i can add code so that it updates automatically?
of course there is you will have to learn some php-mysql for that purpose... i would recommend, you can switch over to wordpress, it would be more efficient, from the production point of view...
As the above post, because of your static pages, the page must be not update automatically. You could add the dynamic program of message board.
if you use auto-update, it will be not static page any more. php-mysql can that auto-update. why not using wordpress script there? or get on coder to code for you a custom script.
I'm not sure if you're using a specific script, but it sounds like you're using plain static HTML. There's no way for it to "automatically update" because it is static. You either use a php script or you build your own and include it on your static page.
I agree that you should go to a cms like wordpress. But.... You could use a simple php include (server side include) so that you only have to update one php file every time you want to update all the 'recent posts' sections on every page. Your server will need to support php of course... Here is a tutorial I found on google. Although it is for a menu, you could use the same principle, just put your recent posts code into the php file that the tutorial names menu.php: http://www.tizag.com/phpT/include.php There are tonnes more tutorials avaiable if you google "simple php include tutorial"
Ok i have just done this tutorial. Does this mean that i will have to change all my file names to .php instead of html. Plus add the code into every one of my pages?
Yes. You will need to add the php include line of code to every page and save each as their own php file. Now when you want to edit your recent posts, you just amend the included php file and it will automatically update in every page you have included it in. But I should have mentioned before, your host will need to support php...Most do these days so hopefully your alright!
Yea im with hostgator so shouldn't be a problem. A problem i have found though is how do i make it correspond with my css because on the tutorial its horizontal and my 'recent posts' are vertical.
Can you post the code of the php file you are including? And a link to your website? That would help alot.... But generally, if you want your recent posts to list vertically, you should list them in an unordered list. Put a div wrapper around the unordered list and use css to style it so it displays how you want.
http://www.modernrunner.co.uk/ Okay there is the site. As you can see on the left hand side there is 'recent blog posts'. There is text below each module so i won't be able to simply name it. I have tried using the menu.php as this : <ul> <li> <h4><a href="runners-goals.html">Runners: What are your goals?</a></h4> <p>People all have their reasons for running but not many of them have goals of what they want to achieve...</p> </li> <li> <h4><a href="psychological-benefits-exercise.html">Psychological Benefits of Exercise</a></h4> <p>Psychological benefits of exercise are always a large talking point when people are asked why they start running...</p> </li> <li> <h4><a href="10-effective-avoid-injury.html">10 Effective Ways To Avoid Injury</a></h4> <p>Injury can be a pain, especially when it’s running injury. Here are 10 effective ways to avoid injury which can be started on your next run...</p> </li> </ul> which obviously doesn't work. As for the php include will i delete my actual side bar posts and put "<?php include("menu.php"); ?> </body> </html>" ?
So currently you have a div class content. You need to put the <?php include("menu.php"); ?> inside that div. That is all you should need to do. As long as your css applies to the content div, the formatting should stay the same as you have currently. You will also need to name the pages that you are including the php inside "filename".php, rather than .html You said "which obviously doesn't work". Do you mean the include is not working at all? Or the list is not formatted how you want it?
Ok thanks i think i have cracked it now Managed to add the php and it worked. Thing is what do i do with my static html pages now. Just delete them? Also is there any code that i can use to add pages to my blog or can i just use the php include function?
Ok, glad you sorted it!! If you are only using the php pages now, you could just save your html files in a backup folder on your web server or computer. You never know when you might need to revert back! I rarely completely delete anything just in case! If you want to add a page, you will still need to create it. Theoretically you could custom code a full php website where the header, menu, footer, sidebar and content are all called with includes...But that would be unnecessary when you could just use a CMS like wordpress. There are a lot of free themes you can download and play with to figure out how wordpress works and lots of free tutorials and forums like this where you can get assistance. I would highly recommend trying wordpress as it is extremely powerful, especially with some of the new features in the recent 3.0 release.
Thank you very much. I was looking at wordpress before and will definitely consider using it now. Reputation was added a few days ago for you friend