Forum Moderators: coopster

Message Too Old, No Replies

templates, web pages, and mysql

         

kbrowder

3:44 pm on Aug 18, 2008 (gmt 0)

10+ Year Member



Greetings to all.

I am less than a newbie here, so please be kind.
What I need:
I am wanting to change my whole web site to place my articles into a database and use a single template to show them.

I would also like to be able to paginate the articles but I am at a loss as to how to do that.

I understand that these things can be done using DHTML with php and mysql but that is as far as my understanding goes. When tutors begin talking about things like this, they all seem to start at least at the intermediate level.

Does one have to start from scratch in all these things to be able to do what I want to do? I'm 76 years old and to begin at the bottom is more than a steep learning curve for me.

If someone could help I would be deeply grateful.

My web page address is under my signature.

Thanks for any consideration.

Ken Browder

[edited by: jatar_k at 4:18 pm (utc) on Aug. 18, 2008]
[edit reason] no sigs or urls thanks [/edit]

RonPK

4:50 pm on Aug 18, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello kbrowder, welcome to WebmasterWorld.

It seems you are looking for a content management system (CMS). Have you considered using an existing CMS? They require little or no coding, which should save you from learning PHP and MySQL. Many of them, like websitebaker, are free software, and may suit your needs.

kbrowder

6:15 pm on Aug 18, 2008 (gmt 0)

10+ Year Member



Hello RonPK and thanks for your reply.

No, I've been there and done that. I want control over my site that I can't do with CMS.

I guess these things are just too complicated for me. It was hard learning HTML and CSS.

I'm trying to simplify everything so that there is just not so much work to making changes.

I was checking out PHP and MYSQL but it seems that they talk about lines and tables, etc.

I'm wanting to keep my articles (pages) in a database to be called by maybe PHP.

I think maybe it is just too difficult for me and that I will just have to be satisfied with what I have. I don't want to change the look of the pages and with CMS I would have to be able to go in and make many changes to keep my look.

thanks anyway. I am grateful for the reply.

Ken

StoutFiles

8:07 pm on Aug 18, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



MySQL is just like a big Excel file, with rows and columns for your data. With PHP, you can insert, search, delete, and extract data from your MySQL table. The PHP code will be mixed in with your HTML code wherever you need to call something from a database.

For your MySQL table, look up PHPAdmin. Google 'php tutorials' and 'mysql tutorials' to learn the rest. If you have questions while trying to learn from tutorials, people here wil be willing to help you.

Radium

8:40 pm on Aug 18, 2008 (gmt 0)

10+ Year Member



Here's a very simple example of how you might list articles on a web page.

database:

1 table "articles": cols: id, date, title, content

code for site:

<html>

<head></head>

<body>
<?php

// connect to mysql database and select the correct schema
mysql_connect('DBHOST','DBUSER','DBPASS');
mysql_select_db('DBNAME');

// query database for latest 10 articles
$query_articles = "SELECT * FROM articles ORDER BY date LIMIT 10";
$articles = mysql_query($query_articles);

// loop through each article fetched from the database
while($article = mysql_fetch_array($articles)) {
?>
<div id="post">
<h1><?php echo $article['date'] ." - ". $article['title']; ?></h1>
<p><?php echo $article['content']; ?></p>
</div>
<?php } ?>

</body>

</html>

[edited by: Radium at 8:55 pm (utc) on Aug. 18, 2008]

kbrowder

8:40 pm on Aug 18, 2008 (gmt 0)

10+ Year Member



StoutFiles...

Thank you.

I appreciate your taking the time to reply.

Ken

kbrowder

8:44 pm on Aug 18, 2008 (gmt 0)

10+ Year Member



Radium....

thanks. I will copy that and save it. With more study maybe I'll be able to use it.

I do appreciate it.

Now if I can just get my articles into a database... :D

Ken

kbrowder

10:22 pm on Aug 18, 2008 (gmt 0)

10+ Year Member



Well Radium... talked with a friend who could set up a database for me with those columns.
However, your code evidently pulls in a list of articles from which a person would choose.
What I'm looking for is a template so that an individual article will be pulled from the database into the middle content area of the page for reading.
If you could email me, I will give you the address of my site and you could see how I have it structured now.
I don't want to change the layout...just the way the articles are accessed.
Am I being clear? Probably not. I'm not a logical thinker,more of a creative one, sorry.

Anyway thanks for your help.

Ken