Say I want to use one template for all my pages, have the template in one file, and the actual content in another. Template meaning including things like links to other parts of the site, "back" links, etc. Is this something I can do with XML, or do I need PHP or whatever for that?

From: [identity profile] eponymous.livejournal.com


Drive-by commenting. :)

Xml, no. Server-side includes (ssi) are designed for exactly the sort of thing that you're talking about, but you could also do it with php, yep.

From: [identity profile] bubosquared.livejournal.com

Re:


Hey, thanks! Do I need to pay for PHP? And how hard is it to learn PHP?


From: [identity profile] eponymous.livejournal.com


For the kind of thing you want to do, php is very easy. You'd basically make template files -- your header, your links, whatever -- and then call them into the main page with a simple line of code. It's a snack.

As for paying, you'd need to check whether your hosting plan already provides php. If they don't, however, it's really not worth paying the extra just to do what you want to do. It's like buying an entire chocolate cake because you want to eat the cherry on top. :)

A better option, if you can't get php for free, is to check if you have ssi. For what you want to do, the method will be virtually identical to what you'd do with php, and pretty much all hosts support ssi these days.
birdsflying: (geek)

From: [personal profile] birdsflying


PHP itself is open source, so it's free but needs to be installed on your server. (insert rant about 'how we have to pay for it with the host when it's open source' here. :g:) Most hosts already have it installed, check with your hosting plan.

http://zalary.com/substance/phptutorial/ - this is a good tutorial for doing what you want to do. I've used it myself many times, is marvelous! :g: (working example: digitalcandy.net)

From: [identity profile] bubosquared.livejournal.com

Re:


Woohoo! Thank you! Yeah, we've got PHP installed (and thankfully my host is not an actual big company, and I know the guy running it, so I can get that kinda stuff installed for free. ^_^)

Thanks for the tutorial link.

From: [identity profile] bubosquared.livejournal.com

Re:


Thanks! You're a veritable tech godess, and I bow to you. ^_^

From: [identity profile] bubosquared.livejournal.com


Okay, um. Help? I've tried to make a test page, and the main one looks okay:
http://www.independentsoul.net/test/template.php
but when you follow the link in netscape, it doesn't use the template for the second page as well. (It does in IE.)

Also, how can I make it so that the index page automatically loads, with the template? (create index.php, perhaps?)
birdsflying: (Default)

From: [personal profile] birdsflying


Ok. first question I can't answer straight away. Can you send me the php file (I want to compare the code with one of mine because digitalcandy's template links work in netscape and php code is processed into html when you view source on the server.) - meg@intergalactic.nu (cc: digi_goth@yahoo.com) and I'll have a look because it should work.

As for the second question. Yeap. Just rename template.php to index.php :g:


From: [identity profile] bubosquared.livejournal.com

Re:


You = saint. Thank you. I know it's not just because I still use NN4, because, as you said, dc.net works fine in that. I've zipped up the files and sent 'em to you (er, not cc'ed to the yahoo addy, though. Will go send it over there now.) Thanks.

(Now if you'd happen to know a good freewhare program to search and replace text in multiple files, I'd be even more grateful. ^_~)
birdsflying: (Default)

From: [personal profile] birdsflying


Great! I'll get the dc.net files and put 'em both on my laptop. Will email you when I've managed to poke them into submission. :g:

As for a freeware program. :puts on pimping hat: You ask and I provide. heh. - www.notetab.com - the lite version is the freeware one and I *heart* it. I used it on my fic for changing css and all.

From: [identity profile] bubosquared.livejournal.com


Actually, I've just changed the .php file to index.php and now it works fine. Huh. Go figure. Thanks for the other pointers, anyway. ^_^
birdsflying: (hrm)

From: [personal profile] birdsflying


Ah. that's odd. Anyway, checked the code and couldn't see why it wasn't working for you because the code was fine, exactly the same as digicandy. Very odd.

But, glad to have helped.

From: [identity profile] bubosquared.livejournal.com

Re:


Thanks again. ^_^ And hey, I've come to the conclusion that IT is 50% tech knowledge and 50% voodoo. *shrug*
.

Profile

bubosquared: (Default)
Sofie 'Melle' Werkers

Most Popular Tags

Powered by Dreamwidth Studios

Style Credit

Expand Cut Tags

No cut tags