FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


[php]putting script fragments together?





riv_
I've made most of my scripts for a page I'm making. So I have all (well, most) of the pieces of my first real php page.
But now that it's time to put them together, I'm not sure I'm doing it right?
How do I control the flow from script to script all layed out on a nice page?
Do I separate each function and do a master page (index.php?) with all the include()s?
How is CSS styling for php different than just with html, if at all? Why haven't I come across this info yet? Is it just obvious? I thought I knew, but now...
Sorry to ask stupid questions, but the stuff I expected to be easy before, wasn't easy (which is OK, 'coz the hard stuff wasn't so bad!); but now I just want to take advantage of all your expertise before banging my head against the wall for a week (or more)!
(And I know NOTHING about content management systems, so if you're going to recommend one, please explain why I need one and how they work.)
Any advice would be appreciated!
BlackSkad
Well, using html AND css with php isn't different than just html. Consider the fragment below.
Code:
$linkClass = ($importantLink)? "important": "normal";
if ($importantLink)
    echo "<a href='boo.html' class='".$linkClass."'>Foo</a>";

This will produce a link with css-class important, if the link is important.
You adapt the css in the same way as you do with html:
Code:
<?php $color = ($background == "black") ? "111111" : "000000";?>
.yourClass {
    color: #<?php echo $color; ?>;
    background: <?php echo $background; ?>
}


How you construct you pages is just a matter of taste. Some people prefer an overall index.php-file, others more like to use separated files. It's just your choice.

Ow, and about the content-managment things. Those are nice script, and most of them are very easy to use. But if you enjoy scripting, why would you stop and use the stuff of someone else? Very Happy At the moment your head is going to explode as a reaction to all the banging on the wall, you might consider using a cms, but I recommend you to search a little longer. Or just put the script aside for a little while and do something else. Suddenly you'll get that 'Eureka'-moment...

BlackSkad

ps I just hope I ecxplained everything clearly Wink
riv_
BlackSkad,
I think that's what I needed to hear... I probably need to take a break. This shouldn't be difficult, and I've totally intimidated myself.
Thankyou for the encouragement. I really didn't want to use a cms, but I'm starting to doubt myself.
I guess I'll work on a static page for a few days, and put this on the back burner. Maybe it will look a little different when I come back to it.
I'm still open to suggestions, but I'm going try and take that timely advice, and chill out! Cool
MonkeyWrench
all scripting is very hard, especially to learn, takes years, i need some1 to help make me a php game but its gonna take years Sad
clip
depends on your will to learn though. I learned advanced php and mysql in less than a week. i only had a book with me which I finished too fast. ^^
Related topics
Hot or Not PHP-Nuke script
What's the best PHP Wiki script?
problem with a php randomizer script
Install PHP Teamspeak script
php mailing script
Php voting script needed (URGENT)
PHP Get script name?
PHP logging script
I need a php upload script, NEEDED BADLY
Putting Training Manuals Together
30frih for a php rotator script
PHP contact script...
Browser close run a php script.
need help in a simple php register script based on flat file
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.