PHP : Main
I already made that tutorial 2 weeks ago in french and I decided to translate it :)
So, did you ever want to create a gallery on your site, but you don't want to create a page for each image? Here's the solution!!
I will take as example an image gallery , but you could use this code for anything (videos, flash, etc)
1. First of all, upload your images with simple names (ex: gallery1, gallery2, etc…)
2. Create a page where you will put the links to your different images.
3. Create a new page with the *.php file type.
4. Now I will explain you the codeyou have to put!
First, the code:
<img src= "
<?
$src = $_GET [“image”]
echo $src
? >
“/>
Now let us analyze the code!
<img src= "
Quite obvious, the code to put an image (only the beginning)
<?
Opens the PHP code.
$src = $_GET [“image”]
Defined the variable “src”. In your URL, you will have to put, afterthe name of page (ex: image.php), this: ”? image=name of the image.jpg " The $_GET function will seek in the URL the value of “image” (defined in the URL with”? image=URL ") Then, if my image has the name “image1.jpg”, the URL would have to look like that:
www.mysite.com/image.php?image=image1.jpg.
echo $src
Usse the ECHO function to write the URL of your image (image1.jpg).
A principle that it is necessary to understand in PHP is that all the code is executed on the host's computer and is sent has the user in plain HTML.
? >
Closes the PHP code
“/>
Closes the image code
Then, the output of this code would be, after execution on the host's computer:
<img src= " image1.jpg "/>
A very simple code which saves you hours (minutes?) of work!
Obviously you can replace the code outside of the PHP by anything you want, I just explained the basics!
-Disregard females (fuck bitches)
-Acquire currency (get money)
-Ignite cannabis frequently (smoke sum with your homies)