GetDotted Domains

Viewing Thread:
"Should I be using php?"

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Thu 04/09/08 at 17:31
Regular
Posts: 19,415
I mastered HTML and CSS (kinda), but I never really got into php despite owning a few books.

When I create a site I can change pretty much anything with CSS, but if I want to change big chunks of the site layout I have to alter every single page which is not good. So my question is, should I have studied php all those years ago? Is there anything out there that can do all this form me for free so I dont have to change 100s of webpages individually? Or maybe there's a new programming language in development thats better than ASP and PHP, in which case should I start learning now?

Its okay, this wont affect my current site, but I need to know for future projects. Freeola is done in php right? it cant be that difficult. Could I be able to master it within a week?

Thanks for your help guys, I appreciate it.
Tue 30/09/08 at 20:46
Regular
"Ctrl, Alt, Woof"
Posts: 212
No probs Machie - let me know how you get on.

Also - if you want to show a random image instead of a whole page then replace the "page1.php, page2.php" etc in the array with "image1.jpg, image2.gif" etc and also add the last lines as


//finally, include the page
//include_once("$page");

//or show the graphic
?>
<img src="<?php echo $page;?>" />



JTD
Mon 29/09/08 at 15:05
Regular
Posts: 19,415
Garin wrote:
> The only difference is how PHP behaves when the file doesnt
> exist. Include just throws a warning and carries on executing
> the script. Require throws a fatal error and wont execute the
> rest of the script.
> So up to you really.

In that case something is better than nothing, so I'll stick with includes. Thanks Garin. :)

> I have the header and nav in seperate includes/requires, but as
> they're right next to each other should I just put them into
> one
> file?
>
> Yes?

I'm Ron Burgundy?
Mon 29/09/08 at 14:48
Regular
"Devil in disguise"
Posts: 3,151
Machie wrote:
> I have a few questions, should I be using include()
> or require()?

The only difference is how PHP behaves when the file doesnt exist. Include just throws a warning and carries on executing the script. Require throws a fatal error and wont execute the rest of the script.
So up to you really.

> I have the header and nav in seperate includes/requires, but as
> they're right next to each other should I just put them into one
> file?

Yes?
Mon 29/09/08 at 14:25
Regular
Posts: 19,415
Oops sorry Jim, I didn't notice you'd done this for me. Thank you so much. :D I'll have to try it out in a bit.

I have a few questions, should I be using include() or require()?

I have the header and nav in seperate includes/requires, but as they're right next to each other should I just put them into one file?
Sun 21/09/08 at 18:04
Regular
"Ctrl, Alt, Woof"
Posts: 212
Machie,

In response to your random page include - try this - you will need to create yourpagex.php and include any paths if you create the files in a seperate directory from the page you call this from.

I hope it helps.



<?php
//start a session
session_start();

//create an array. Add your pages here.
$pageArray = array("page1.php", "page2.php", "page3.php");

//count the elements for later use
$count=count(pageArray);


//check to see if the session var is set (it won't be on the first page load)
if (isset($_SESSION['page'])) {$lastPage = $_SESSION['page'];} else {$lastPage = -1;}

//check to see if the same page has been choosen since the last load but not if there is only one page in tha array.
if ($count >=1){

//chooses a random entry from the array making sure it is not the same as the last page loaded
do{
$random = array_rand($pageArray);
}
while ($lastPage == $random);
}

else

{//set the $random var to 0 if there is only one element - NOTE: there is no check for zero length array.
$random = 0;};

//set the session var for last page
$_SESSION['page'] = $random;

//get the page to include
$page= $pageArray[$random];

//finally, include the page
include_once("$page");
?>
Sat 20/09/08 at 10:47
Regular
"Ctrl, Alt, Woof"
Posts: 212
Machie, Garin is right
should be adequate but if you need a little bit more control then stick a single column, two row table in the
and set the borders to 0 - put your image in the top cell and your text in the bottom one.

Also, I now understand what you want with your random cycling includes - it's a lot easier than what I first thought you were asking for. I'll post some code for doing what you want a little later.
Thu 18/09/08 at 01:10
Regular
"Devil in disguise"
Posts: 3,151
Not sure what your problem is, use
if it works.
Wed 17/09/08 at 23:54
Regular
Posts: 19,415
Garin I'm stuck and need your help :( I have a simple div box and I want to have text and an image in it (text on top, image below). How do I go about doing that? In the old days I just put in

or
, but I want to do it correctly. How about wrapping

around the iamge is that correct?

Tue 16/09/08 at 15:05
Regular
Posts: 19,415
Yeah I much prefer to keep it simple and not go overboard. I suppose I should use them only when I know I will be making changes rather than incase I need to make changes like a "contant me | sitemap" menu at the top, I don't think I need to change that much if at all. Thanks Garin.
Tue 16/09/08 at 14:55
Regular
"Devil in disguise"
Posts: 3,151
Theoretically, theres no limit. Hopefully though if you have too many includes then common sense should kick in and you'll realise you need to reorganise.

How many is too many though? Depends who you ask. Personally, 5 is about my limit but admittedly I'm efficiency driven when it comes to coding.

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

First Class!
I feel that your service on this occasion was absolutely first class - a model of excellence. After this, I hope to stay with Freeola for a long time!
Easy and free service!
I think it's fab that you provide an easy-to-follow service, and even better that it's free...!
Cerrie

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre
Feedback Close Feedback

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.