Welcome Guest ( Log In | Register )

 
Your Kudos
Your Kudos Ranking --
 
Reply to this topicStart new topic
>  Very Basic Php
   
 
Ephonetica
  Post#1 | Oct 22 2004, 17:25 + Quote Post Go to the top of the page
User is offline
Mini Profile
PM
2200
Increase this members Kudos



Weapon: Magnum
Posts: 3,912
Member No.: 8
Joined: 13-October 04
*****************

If you want to run a php site very basically, use this very simple method.

Make your template and stuff.
Where you want your content to appear, put in this tag:
CODE
<?php include('content.txt'); ?>


Save it as index.php.

Now open up notepad and put in this code:
CODE
<?
switch ($id)
{
     case whatever:
                     include('includes/staff.html');
                     break;
     case whatever:
                     include('includes/anything.html');
                     break;
     case whatever:
                     include('includes/anything.html');
                     break;
     case whatever:
                     include('includes/anything.html');
                     break;
     case watever:
                    include('includes/anything.html');
                    break;
              default:
                     include('includes/news.html');    
                     break;
        
}
?>



Save as content.txt
In your ftp, create a folder called includes and all your content goes in there.
Don't include the template, just the writing/pics.
Then change "whatever" to what you want, e.g affiliation. and anything.html to the page.
Done.

edit: I forgot to pop this in: To add a new page, use the
CODE
     case whatever:
                    include('includes/anything.html');
                    break;

code. Always but that before the default smile.gif

All you do then is http://yoursite.com/index.php?id= whatever you changed "whatever" to.
Leave your default as news and news in includes/news.html

Enjoy biggrin.gif


by nad


-----------------------------

I would say to do this easier....

CODE
<?php

if (isset($id) && file_exists('includes/' . $id . '.html')) {

include('includes/' . $id . '.html');

} else {

include('includes/news.html');

}

?>


Now put your pages in the folder includes, so say you put: bla.html, bla2.html, bla3.html there...
Use it as follows:
http://yoursite.com/index.php?id=bla
http://yoursite.com/index.php?id=bla2
http://yoursite.com/index.php?id=bla3


This code also checks if the file exists, so if you for example put "id=bla783" after the url, it would just include news.html instead...

by lucas

This post has been edited by Lies of Silence: May 17 2007, 11:37


--------------------
IPB Image

bad as ass.
 
Nad
  Post#2 | Oct 23 2004, 20:28 + Quote Post Go to the top of the page
User is offline
Mini Profile
PM
0
Increase this members Kudos

Weapon: Flower
Posts: 53
Member No.: 38
Joined: 23-October 04
**

thanks for the move haly!
does anyone know how i can get

CODE

index.php?blah=blah&blah=blah&blah-blah


this will be greatly appreciated wink.gif


--------------------
VCU Elite... I remember the old days...
 
Lucas
  Post#3 | Oct 23 2004, 23:10 + Quote Post Go to the top of the page
User is offline
Mini Profile
PM
2110
Increase this members Kudos



The Undutchable
Posts: 1,491
Member No.: 1
Joined: 12-October 04
***********

QUOTE(Nad @ Oct 23 2004, 08:28 PM)
thanks for the move haly!
does anyone know how i can get

CODE

index.php?blah=blah&blah=blah&blah-blah


this will be greatly appreciated  wink.gif
*



you mean how to define multiple variables in the url...

index.php?var1=bla&var2=blabla

well then in index.php you can call the vars with

$var1
$var2

OR

$_POST[var1]
$_POST[var2]


--------------------
 
Nad
  Post#4 | Oct 24 2004, 10:55 + Quote Post Go to the top of the page
User is offline
Mini Profile
PM
0
Increase this members Kudos

Weapon: Flower
Posts: 53
Member No.: 38
Joined: 23-October 04
**

so i could have:
CODE

<html>
<body>
<?php
$var1="cat";
$var2="blah";
$var3="page";

echo="\index.php?"$var1"&"$var2"&"$var3"\>page here</a>
</body>
</html>


sorry if this is wrong, i am not php expert, not even intermediate.


--------------------
VCU Elite... I remember the old days...
 
Nico
  Post#5 | Dec 17 2004, 20:06 + Quote Post Go to the top of the page
User is offline
Mini Profile
PM
3740
Increase this members Kudos



THE REVIVALATOR
Posts: 6,812
Member No.: 18
Joined: 13-October 04
*********************

man it's like chinese to me


--------------------
TNENIMMI SI LAVIVER UG
Nico's the name, bumping's the game
 
Mister V
  Post#6 | Dec 17 2004, 21:06 + Quote Post Go to the top of the page
User is offline
Mini Profile
PM
1940
Increase this members Kudos



Playing: Mass Effect
Weapon: Submarine
Posts: 10,079
Member No.: 21
Joined: 14-October 04
*************************

QUOTE(Shadow @ Dec 17 2004, 23:06 )
man it's like chinese to me
*


no its not! its american. cant you see the dollar signs everywhere shifty.gif

anyway cant you have a better tutorial? i for example want a tutorial the type of yourhtmlsource.com - easy to understand and quite relaxed. cant get a thing in here.

anybody can tell me a good site about that?

This post has been edited by Mister V: Dec 17 2004, 21:10


--------------------
IPB Image
Then God said, "Let there be win",
and there was win, and it was good.
 
Faint
  Post#7 | Dec 31 2004, 02:00 + Quote Post Go to the top of the page
User is offline
Mini Profile
PM
10
Increase this members Kudos



Playing: Metal Gear Solid 4
Cute In A Creepy Way
Posts: 355
Member No.: 10
Joined: 13-October 04
******

Man this is very confusing.

I want to learn this stuff so bad.

So I try and learn from the turorial on W3Schools, and it still is difficult.

If PHP was viewable through page source, it would help me a lot.

Thats how I figured out HTML. I would go to websites and veiw the page source, and teach my self.

I might have to have my friend teach me some PHP.
dry.gif

This post has been edited by Faint: Dec 31 2004, 02:00


--------------------
IPB Image
 
ringwraith
  Post#8 | Dec 31 2004, 02:41 + Quote Post Go to the top of the page
User is offline
Mini Profile
PM
660
Increase this members Kudos



Weapon: Sword
Posts: 2,111
Member No.: 97
Joined: 25-October 04
**************

Unfortunately you can't view the source like html, because it's server side code, but there are a lot of good websites out there where you can learn things. It helps if you study a little bit of computer science and learn some programming basics, like when to use loops like 'for', 'if', 'while; etc. I took a course once and it helped me to understand it quite a bit, because a good teacher forces you to think of ways to solve a problem.

Here's a good site where you can find some sample scripts and stuff. I've seen some really good examples of other sites in these forums too.

Php Freaks

and in the words of Masterchief Holy Cow Pie!

I'm sure if you have any questions as you go through it, people here will try to help you out! Good luck, it's totally worth the effort to learn! thumbsup.gif


--------------------
 
Faint
  Post#9 | Dec 31 2004, 05:07 + Quote Post Go to the top of the page
User is offline
Mini Profile
PM
10
Increase this members Kudos



Playing: Metal Gear Solid 4
Cute In A Creepy Way
Posts: 355
Member No.: 10
Joined: 13-October 04
******

Computer Science:

Will someone please explain to me what this is.

Sounds like a college course. If so, what will they teach you in that course?


--------------------
IPB Image
 
NNY
  Post#10 | Dec 31 2004, 05:10 + Quote Post Go to the top of the page
User is offline
Mini Profile
PM
0
Increase this members Kudos

Playing: BF2
Weapon: Rock
Posts: 558
Member No.: 667
Joined: 30-December 04
********

it's simple..... shifty.gif


--------------------
user posted image
 
Mister V
  Post#11 | Dec 31 2004, 10:08 + Quote Post Go to the top of the page
User is offline
Mini Profile
PM
1940
Increase this members Kudos



Playing: Mass Effect
Weapon: Submarine
Posts: 10,079
Member No.: 21
Joined: 14-October 04
*************************

QUOTE(Faint @ Dec 31 2004, 08:07 )
Computer Science:

Will someone please explain to me what this is.

Sounds like a college course. If so, what will they teach you in that course?
*


theyll teach you how to plug in your computer rolleyes.gif

so you dont have to call the Tech support every time somebody unplugs it shifty.gif

anyway, i also want to learn that! mad.gif and i ant find a good site like YourHTMLSource.com mad.gif


--------------------
IPB Image
Then God said, "Let there be win",
and there was win, and it was good.
 
ringwraith
  Post#12 | Dec 31 2004, 14:06 + Quote Post Go to the top of the page
User is offline
Mini Profile
PM
660
Increase this members Kudos



Weapon: Sword
Posts: 2,111
Member No.: 97
Joined: 25-October 04
**************

Sorry to be cryptic, actually the defintion of computer science where I took the course at Ryerson is the study of programming concepts. It's kind of a broad category could cover other things too like hardware design and software engineering or programming artificial intelligence.

What I really meant to say is take a programming course. If you can't find one that teaches php, you can still learn the basics of programming from a language like C++ or Java that will make learning php a lot easier to understand. Maybe you can find a course that teaches server side web programming or e-commerce.


--------------------
 
Mister V
  Post#13 | Mar 17 2005, 10:17 + Quote Post Go to the top of the page
User is offline
Mini Profile
PM
1940
Increase this members Kudos



Playing: Mass Effect
Weapon: Submarine
Posts: 10,079
Member No.: 21
Joined: 14-October 04
*************************

Now I found a cool site woot.gif

http://www.zend.com/php/beginners/index.php

praise.gif

It seems much much more horrible than HMTL crazy.gif ah, my head!

This post has been edited by Mister V: Mar 17 2005, 10:31


--------------------
IPB Image
Then God said, "Let there be win",
and there was win, and it was good.
 
IKHAM
  Post#14 | Mar 17 2005, 20:14 + Quote Post Go to the top of the page
User is offline
Mini Profile
PM
2110
Increase this members Kudos



Playing: Gears of War
Weapon: Uzi
Posts: 4,511
Member No.: 2
Joined: 12-October 04
*******************

php is a little harder than html. Especially if you are not familiar with programming techniques.

However, php is one of the easiest programming languages to learn. It has been developed to be easy and even breaks standard programming practices just to be simpler.

However once you get past that initial confusion stage, the world is your oyster. I'm really glad i learned how to do it. I am know whre near up to Lucas' level, but i know enough to create a simple content management system.


--------------------

Please help me get George the Gorilla to the Jungle >> [url=http://www.justgiving.com/georgeinthejungle]Let's get George back to the Jungle[/url]
 
Mister V
  Post#15 | Mar 17 2005, 20:39 + Quote Post Go to the top of the page
User is offline
Mini Profile
PM
1940
Increase this members Kudos



Playing: Mass Effect
Weapon: Submarine
Posts: 10,079
Member No.: 21
Joined: 14-October 04
*************************

Yeah, pray to Lucas - the coding god praise.gif tongue.gif

I guess I should go study first what other people study first - namely, basic programming languages (such as...Basic! tongue.gif Pascal, C and so on...)


--------------------
IPB Image
Then God said, "Let there be win",
and there was win, and it was good.
 
Nad
  Post#16 | Apr 24 2005, 19:46 + Quote Post Go to the top of the page
User is offline
Mini Profile
PM
0
Increase this members Kudos

Weapon: Flower
Posts: 53
Member No.: 38
Joined: 23-October 04
**

i found php hard at the start, now its just a doddle.
i have learned how to get stuff like index.php?game=sa&section=missions&mission=reuniting_the_families
thts just with flat files tongue.gif
you have to do it alot to rember it.


--------------------
VCU Elite... I remember the old days...
 
1 User(s) are reading this topic:
 
 
Reply to this topicStart new topic
 
 
 
- Choose Skin: