Home Owner Site Info Resources Tutorials MySpace

Coding Tutorials

Glitter Generator

Wanted to know how to get glitter generators on your site? Follow this tutorial.
Your site must allow PHP and you should be able to make your own glitters. Knowing some HTML/PHP would help for this tutorial.
Press down "Ctrl" and "C" to copy codes!!

Bold words are there to help you understand it better. Edit all the CAPITAL words shown in the codings.

Make 2 PHP pages from notepad/dreamweaver called "glitter.php" and "style1-changer.php". Adding the ".php" while saving the pages would make the pages in PHP.
Create a new folder in your Documents or wherever (right click > New > Folder) called "style-1". Make individual glitter letters and save them all in that folder. So you should have the 26 alphabet glitter letters in the style-1 folder.

Open the glitter.php page (right click and select to open using Notepad) copy and paste this exact code inside it....

<form method="post" action="style1-changer.php"> Type Text To Convert:<br /> <input type="text" name="text" /><br /> Select a style:<br /> <select name="style"> <option value="style-1">Style 1</option> </select> <br /> <input type="submit" value="submit" /> </form> Create two more folders to make it organised. I have made a folder called "glittergens" and "pink". The folder "glittergens" is where I am going to put all of my glitter letters for the generators. The folder "pink" is made because I want to make pink coloured glitter letters first. You can make blue, orange or whatever colour you like. You can even name the folder to "curvy" or "birthdays" if you're not sorting your glitters by colour, but by style- you'll manage to know how to code once you've made a generator. Upload the two folders on your site, first upload the "glittergens" folder in your root directory. Double click the "glittergens" folder and upload the "pink" folder inside it.

Next, on your style1-changer.php page (right click, choose to open with notepad), copy and paste this code (edit all the obvious CAPITAL areas, not "POST" etc.):

<[REMOVE THIS]? php $urlto = "http://YOURSITE.COM/GLITTER-GEN-FOLDER/COLORFOLDER/"; //keep trailing slash $text = $_POST["text"]; $text = trim(strtolower(stripslashes(strip_tags($text)))); $style = $_POST["style"]; $style = trim(strtolower(stripslashes(strip_tags($style)))); define('REGEXP_FILESPLIT', '/[^\\d]|[\\d]+/i'); preg_match_all(REGEXP_FILESPLIT, $text, $result); for($i = 0; $i < count($result[0]); $i++) { print "<img src=\"$urlto".$style."/".$result[0][$i].".gif\" title=\"Make your own glitters at YOURSITE.COM\" alt=\"".$result[0][$i]."\" />"; } print "<BR><textarea>"; for($i = 0; $i < count($result[0]); $i++) { print "<a href=\"http://YOURSITE.COM\"><img src=\"$urlto".$style."/".$result[0][$i].".gif\" title=\"Make your own glitters at YOURSITE.COM\" alt=\"".$result[0][$i]."\" border=0 /> </a>"; } print "</textarea>"; ?> ";

Edit all the areas which are in CAPITAL BOLD words!

Here's an example from the above code:

<?php
$urlto = "http://
sugaryparadise.net/glittergens/pink/"; //keep trailing slash

There is my site's address, along with a folder I have created called "glittergens" and uploaded it to my site. Then I created another folder called "pink" and placed this inside the "glittergens" folder. So the URL of that folder goes at the top of the code.

Now, place the "style-1" folder, "glitter.php" and "style1-changer.php" pages inside the "pink" folder. Example of directories below (bold words are the folders):

ftp.sugaryparadise.net
-> glittergens
---> pink
-----> style-1 >> 26 glitter letters (.gif)
-----> glitter.php
-----> style1-changer.php

See screenshots below...

If you have an error, try changing to URL of your site to your root directory, such as /home/USER/public_html/GLITTER-GEN-FOLDER....

If this tutorial has helped you, please link back http://sugaryparadise.net on your site, thank you. Feel free to contact me for further details or any problems.

Used a tutorial? Let me know through MySpace! :D