Join us at IRC!
Capitalism is an Island of wealth in a sea of poverty
Thursday, May 24, 2012
Navigation
Members Online
Total Online: 37
Web Spiders: 16
Guests Online: 35
Members Online: 2

Registered Members: 70189
Newest Member: CrownClown
Latest Articles
View Thread

HellBound Hackers | Computer General | Webmasters Lounge

Author

Include file with links to facilitate link changes?

ranma
Member



Posts: 269
Location: Behind a sphere
Joined: 27.08.05
Rank:
HBH Guru
Posted on 08-07-09 19:26
Instead of having all your 'a' tags with all the links hardcoded, would it be practical include a file that has all addresses and whenever you need a link to just use the variable for the link?

as in a href='$home'


Wisdom spared is wisdom squared.
Author

RE: Include file with links to facilitate link changes?

AldarHawk
The Manager



Posts: 1662
Location: Canada
Joined: 26.01.06
Rank:
God
Posted on 09-07-09 12:43
Why not just use a database query to do this?


I(don't)See Just ask Yahoo!Taboo! http://www.erikwestlake.com
Author

RE: Include file with links to facilitate link changes?

ranma
Member



Posts: 269
Location: Behind a sphere
Joined: 27.08.05
Rank:
HBH Guru
Posted on 09-07-09 15:45
Because that would put a hellalot of pressure on the DB. And it's pointless to use a db for such a thing. I don't mean storing IDs for threads or such, I mean mostly static links such as the link to the home page or the link to the, say, about page. Using an include should save you some time.

I don't mean an include for something like a sidebar. I was asking this question originally because I'm making a website which has a changing bar.


Wisdom spared is wisdom squared.
Author

RE: Include file with links to facilitate link changes?

ynori7
Future Emperor of Earth



Posts: 1481
Location: #valhalla
Joined: 08.10.07
Rank:
Diabolical
Posted on 09-07-09 16:26
ranma wrote:
Because that would put a hellalot of pressure on the DB.

No it wouldn't. Not unless you've got 100 links that need to be loaded every time the user visits a page in your domain.

Alternatively, you could use XML and PHP's XML Parser. That way you could pair the link with the name you want to give it.




ynori7 http://halls-of-valhalla.org
Author

RE: Include file with links to facilitate link changes?

ranma
Member



Posts: 269
Location: Behind a sphere
Joined: 27.08.05
Rank:
HBH Guru
Posted on 09-07-09 18:58
But why not just use includes?


Wisdom spared is wisdom squared.
Author

RE: Include file with links to facilitate link changes?

p4plus2
Member

Posts: 167
Location:
Joined: 31.03.08
Rank:
God
Posted on 09-07-09 22:06
ranma wrote:
But why not just use includes?


You could, but sometimes the easy way is not the best way. I agree with the XML idea, it is flexible and specialized to its purpose. Using XML forces you to stick to a game plan, this means you won't be tempted to use any 'quick and easy hacks' in your include page for whatever reason. XML can also be held externally, which means if you have a second site they can share urls or you could have a site tag. With XML you would also be able to add more feature to your links, such as adding a tag that will contain styling information.


"You can't be something your not,
Be yourself by yourself
Stay away from me" ~Walk, Pantera

"Playing an acoustic guitar is like having sex with your clothes on" ~Dave Mustaine
p4plus2@hotmail.com
Author

RE: Include file with links to facilitate link changes?

ranma
Member



Posts: 269
Location: Behind a sphere
Joined: 27.08.05
Rank:
HBH Guru
Posted on 10-07-09 01:18
But what are the advantages of using a db?

Using includes seems like it would be more portable and need less setup.


Wisdom spared is wisdom squared.
Author

RE: Include file with links to facilitate link changes?

ynori7
Future Emperor of Earth



Posts: 1481
Location: #valhalla
Joined: 08.10.07
Rank:
Diabolical
Posted on 10-07-09 03:12
ranma wrote:
But what are the advantages of using a db?

Simplicity.

Using includes seems like it would be more portable and need less setup.

Then use includes. It's your site, do what you want.




ynori7 http://halls-of-valhalla.org
Author

RE: Include file with links to facilitate link changes?

p4plus2
Member

Posts: 167
Location:
Joined: 31.03.08
Rank:
God
Posted on 10-07-09 03:25
ranma wrote:
But what are the advantages of using a db?

Using includes seems like it would be more portable and need less setup.


The advantages are mostly the same as XML, however with a DB you don't directly see the file and its 'out of the way' so to speak. PostgreSQL has some good query analysing tools to test speed and such. In a DB you also can sort entries by page they will be used on, thus a query with a WHERE can be used so not all the links must be loaded. Below is an example table which would provide some nice functionality, but change it to how you need.

CREATE TABLE `links` (
`location` varchar(100) NOT NULL,
`style` varchar(250) NOT NULL,
`page` varchar(50) NOT NULL,
) ENGINE=InnoDB DEFAULT CHARSET=latin1



"You can't be something your not,
Be yourself by yourself
Stay away from me" ~Walk, Pantera

"Playing an acoustic guitar is like having sex with your clothes on" ~Dave Mustaine
p4plus2@hotmail.com
Author

RE: Include file with links to facilitate link changes?

ranma
Member



Posts: 269
Location: Behind a sphere
Joined: 27.08.05
Rank:
HBH Guru
Posted on 10-07-09 16:20
Okay. Thanks guys.
And @ynori7, I'm just playing the part of the person against it so I can see the advantages of using the db method.


Wisdom spared is wisdom squared.
Guest
Username

Password

Remember Me


Bookmark This Page
Affiliates
Adverts

 

 

Links
By using, viewing or obtaining any information contained on this site, you agree to the disclaimer.

© HellBound Hackers 2008- 2009. Since 3rd December 2004.