|
Joined: May 2001
Posts: 2,798
Member
|
Member
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 ]
|
|
|
|
Joined: Nov 2001
Posts: 745
Admin Emeritus
|
Admin Emeritus
Joined: Nov 2001
Posts: 745 |
I would have a table with sortid, url and description. Query the records, then use HTML and say [/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.
|
|
|
|
Joined: May 2001
Posts: 2,798
Member
|
Member
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?
|
|
|
|
Joined: May 2001
Posts: 1,042 Likes: 7
Moderator
|
Moderator
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...
|
|
|
|
Joined: Nov 2001
Posts: 745
Admin Emeritus
|
Admin Emeritus
Joined: Nov 2001
Posts: 745 |
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.
|
|
|
|
Joined: May 2001
Posts: 2,798
Member
|
Member
Joined: May 2001
Posts: 2,798 |
Well this is simple as I needed it to be: [code][/code]
|
|
|
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.
|
|
Posts: 449
Joined: February 2008
|
|
Forums63
Topics37,575
Posts293,930
Members13,823
|
Most Online6,139 Sep 21st, 2024
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|