Bordem

God and i thought he was normal
User avatar
tanzadog
Posts: 92
Joined: Sat Mar 22, 2008 9:15 pm

Re: Bordem

Post by tanzadog » Sun Apr 06, 2008 10:06 pm

hey nova, got any tips for a noob ??? i put this site together for a mate but i aint got a clue about hooking it upto a database, i have to change all the pages seperatly, fooking nightmare :)

http://www.eirecane.ie

Cheers

Tanza

User avatar
Supernova
Posts: 1482
Joined: Fri Mar 14, 2008 8:43 pm
What is 3hirty p1us 4orty?: 4

Re: Bordem

Post by Supernova » Mon Apr 07, 2008 9:24 am

If you wanted a cms rather than a blog, I'd recommend joomla or PHPnuke, though both of which you would require a complete redesign of the site :P

What kind of things do you want to connect to the db tanza? Do your prices change/you add more items/you display the quantity remaining?

You could also connect the news bits up, but I don't know whether it'd just be easier to keep doing it how you're doing now..
Image

User avatar
Supernova
Posts: 1482
Joined: Fri Mar 14, 2008 8:43 pm
What is 3hirty p1us 4orty?: 4

Re: Bordem

Post by Supernova » Mon Apr 07, 2008 11:11 am

Hah, no there isn't ;P

You'd have to manually parse through the xml, grab the next line and the previous 4 lines once you've found any containing "?f=4"

Edit:

The above method is a bit stupid and would take much longer to process in php, plus you'd need a lot more code and a lot more variables.

I thought about the way I'd do this...

I'd have one function like this:

functions.php

Code: Select all

<?php

function postXML(date, author, title, content, originator) {

if(originator==4) {

// format and output the content

}
}

?>
And then I'd have in index.php somewhere

Code: Select all

<?php
include('functions.php');

// read the file in

// parse through until you're at the start of the new posts

// loop until end of file {
// string functions to get the content
// parseXML(all the content);
// }
?>
Ie, you just read the entire thing in and just ouput the ones that were from the right sections. This way is also much easier to change later on :)
Image

User avatar
Supernova
Posts: 1482
Joined: Fri Mar 14, 2008 8:43 pm
What is 3hirty p1us 4orty?: 4

Re: Bordem

Post by Supernova » Mon Apr 07, 2008 4:39 pm

What do you mean? :P

You can read the html using these two functions:

http://us2.php.net/curl

http://us3.php.net/file_get_contents

Although the second one is better, it may be disabled on your php config file (you may not be allowed to access files hosted on other people's servers for security reasons, though this probably isn't a problem if in the end the site will be hosted on fester's server)

There's a lot of tutorials, and if you check down the page there's some examples.

Lemme know if you want help, though make sure you show me what you have or i wont be able to see the problem ;P
Image

Post Reply