PDA

View Full Version : Help with cms


owner
09-04-2007, 03:03 AM
Hello,

I am trying to build my own little cms.
I have a ton of questions lol

Here is the demo of my site:

http://www.ottcommunity.com/junk/secretsite/

What i need help with is....

How can I make it so that the news with the highest id is first?

Example: 3,2,1

I want this because when you store your news in the database, you keep getting a higher id number so I need to sort the queries by highest number.EDIT: Ok, I got that by using the DESC command in my query.

Second,

How would you store a navigation menu in the database. Right now I am using html for that menu, but how would you store the menu in the database with multiple topics.

What I want.

Title for each navigation
-Topic
--Sub Link
--Sub Link
-Topic
--Sub Link

Title for a new block
-Topic
--Sub Link
--Sub Link

and so forth, but how would you set that up to go into a database? I am fine making the database and pulling info, but how would you setup the tables/rows to make something like that?

Those are the only questions I have for now, any help would be greatly appreciated.

Thank You Very Much In Advance!
-Owner

chriskq
09-04-2007, 01:51 PM
pretty impressive making you own cms.

not sure on ur ques's too be honest. But have you ever considered using an opensource cms such as joomela. Also would a customised wordpress site do the job ?

owner
09-04-2007, 10:15 PM
I dont want the copyrights on the bottom of the pages :P So thats why I want to make my own lol

owner
09-06-2007, 04:14 AM
Hello,

I was wondering. How can I make it so if someone goes to the link /news.php?id=X, where x being whatever id number the news is. How would you do this?

davidj
09-06-2007, 09:27 AM
page.php?id=<?php echo $row['ID']; ?>

owner
09-06-2007, 11:24 PM
How would I get the id if someone loaded the page like

page.php?id=X

instead of clicking on a link to goto that page.

davidj
09-07-2007, 09:23 AM
not sure what you mean

owner
09-07-2007, 01:33 PM
Lets say someone loaded the page externally. Like they typed into the addressbar

page.php?id=5

How would this script check for that?

Also for my news page I only want 5 news to be loaded. I know it has to do something with limit, but I dont want to put like 4198307209138741234,5. Is their a way to check for how many news are in the database so it would be

$amountofnews,5;

that way it would always load the correct news.

Thank you,
Owner

davidj
09-07-2007, 02:22 PM
i have never known someone type page.php?id=5 as an address

they may save it as a favorite

as for loading the correct news just sort your sql on a date and limit 5. This way you would always get your most current news loaded and only the most recent 5

owner
09-07-2007, 10:50 PM
Ok I got the loading of my 5 latest news :D

Now what I'm trying to say is lets say someone went to page?=6

and then they had it bookmarked and they clicked on it. They would be going to page?id=6. How do I get my php document to find out that the page is id=6?

owner
09-08-2007, 05:05 AM
Ok here is what I have.

http://www.ottcommunity.com/junk/secretsite/archive_news.php

Now I want it so that when a user clicks on the links, it shows loads only that 1 news in the format like on the front page.

http://www.ottcommunity.com/junk/secretsite/

how would you do this?

owner
09-08-2007, 05:45 AM
Dangit, I wish their was an edit button sooooo bad!

Anyways I got it working 100%!

Thanks everyone for helping me out! I am sure I'll have more questions for you pretty soon ;)

-Owner

davidj
09-08-2007, 09:20 AM
nice one mate

owner
09-08-2007, 09:32 PM
Hello,

Here is my next question. How do you show how many queries and the execution time? Lots of forums and sites show at the bottom of the page this information. What is the best method of doing this?

Thank you,
-Owner

davidj
09-08-2007, 09:58 PM
not sure what you mean

a count of how many posts have been made?

don't worry about server return times as this information is relatively useless unless your debugging queries. Concentrate on getting your project working first and then you can add your bells and whistles

owner
09-08-2007, 11:44 PM
Hello,

I am working on an affiliate system and I am trying to echo out the picture and having the picture hyperlinked.

here is my code,

echo "<a href=\"$row['affiliate_link']\">"."<img src=\"$row['affiliate_picture']\" width=\"88\" height=\"31\" />";


NOTE: That is line 26

but I am getting this error
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/gamers/public_html/ottcommunity/junk/secretsite/affiliates.php on line 26

What is the problem with this line?

davidj
09-08-2007, 11:57 PM
you have this...


echo "<a href=\"$row['affiliate_link']\">"."<img src=\"$row['affiliate_picture']\" width=\"88\" height=\"31\" />";


try this

rather than over complicating it by trying to echo the whole tag try this

just drop it inside the <body> where you want it to display

<a href="<?php echo $row['affiliate_link']; ?>" ><img src="<?php echo $row['affiliate_picture']; ?>" width="88" height="31" /></a>

owner
09-09-2007, 12:21 AM
Ok, thank you, works great. I have the database setup, and the layout for the affiliates done.

I am going to finish up a few things quick and then I have some more questions on this for you ;)