Previous Thread
Next Thread
Print Thread
Rate Thread
#104815 06/18/2003 9:56 PM
Joined: May 2001
Posts: 2,798
Member
Member
Offline
Joined: May 2001
Posts: 2,798
I want to have a quick links bar on the top of my webpage. I would also like to store it in my MySQL database, but since I am still a newb when it comes to PHP, I wasn't sure exactly how I might go about doing this.

I was thinking I might use an array. But I wasn't sure if that would work.

Basically it should look like this on output:

[ Link1 | Link2 | Link3 ]

Sponsored Links
#104816 06/18/2003 10:14 PM
Joined: Nov 2001
Posts: 745
Admin Emeritus
Admin Emeritus
Offline
Joined: Nov 2001
Posts: 745
I would have a table with sortid, url and description.

Query the records, then use HTML and say

Code
[/code]Then just echo your [ and | between with some logic.

I use the mysql_fetch_row, then I send the $row[#] to variables, then use the variables in my HTML that I echo.

Some snippets that I use:

[code]
I took out some of my control breaks like where I check to see if it is a different block or the admin flag check on my mainnav.

There is probably a more efficient way to handle this, but this works for what I need it to.

#104817 06/18/2003 10:23 PM
Joined: May 2001
Posts: 2,798
Member
Member
Offline
Joined: May 2001
Posts: 2,798
Heh. You just shot all my hopes of understanding PHP with that snippet. I think mainly cause I don't understand what $detflag is and such. :-D

So basically, I could just have a a few rows, like linktitle, linkurl, and than call it via row? Then have it out put the link with | and then cut the | on the last one?

#104818 06/19/2003 4:37 AM
Joined: May 2001
Posts: 1,042
Likes: 7
Moderator
Moderator
Offline
Joined: May 2001
Posts: 1,042
Likes: 7
another example?, being that you have a pre defined table with linktitle, linkurl and sortorder columns.
[code][/code]Then your $buttons variable would be your links. I dunno...

#104819 06/19/2003 8:02 AM
Joined: Nov 2001
Posts: 745
Admin Emeritus
Admin Emeritus
Offline
Joined: Nov 2001
Posts: 745
Quote
quote:
Originally posted by Tech-Ni-Kal:
Heh. You just shot all my hopes of understanding PHP with that snippet. I think mainly cause I don't understand what $detflag is and such. :-D

So basically, I could just have a a few rows, like linktitle, linkurl, and than call it via row? Then have it out put the link with | and then cut the | on the last one?
$detflag was a variable I used to determine permissions on whether to display a certain line or not. If you look on my main page, you don't see some of the links based off of permissions. I have a secion of links just for my admins that show up for the Admin Tools, Forum CP, and the Moderator's forum. The $detflag variable is checked before I display an item, and if permissions are NOT met, then the item is not displayed.

I just snipped out all of my UBB Authentication checking before I posted that snippet, even though a couple of the pages are checked for permissions before being displayed.

Sponsored Links
#104820 06/20/2003 11:04 AM
Joined: May 2001
Posts: 2,798
Member
Member
Offline
Joined: May 2001
Posts: 2,798
Well this is simple as I needed it to be: laugh

[code][/code]


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Posts: 70
Joined: January 2007
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)