php scripts

php scripts are nifty tools that make the lives of web designers a lot easier. they're more advanced than just html and css, and if i'm being honest? i'm not entirely clued in on how it all works myself lmao. i do know a little, at least enough to be able to use some scripts across my own sites :,) in frankeness i kinda just fiddle around and follow instructions and pray shit works lmao

so this is a small guide to using some very, very basic php stuff, but that i think would be helpful to anybody out there that maintains a website. for my purposes, i'm coming from a place of implementing these scripts on neocities, so your mileage may vary if you want to implement them elsewhere (altho it probably shouldn't be that different elsewhere lol) j

necessary stuff

first off, you'll need a host that offers php functionality, ftp funtionality, and in a lot of cases, database functionality. my recommendation for a free service is byethost. they offer everything you need. i used them for years myself, and while i now have my own domain to host things on, my byethost sites are still up!

note: neocities does NOT offer php functions or databases at all, not even to supporters. while i endorse supporter accounts bc neocities is awesome, you would still need a secondary host offering this functionality

when you sign up with them, they'll give you a few things you're gonna wanna take note of: an ftp username and password, and possibly host and port info. this is the info you'll use to log in and upload things to their server, so keep the info safe

secondly, you'll need an ftp client. i personally have used filezilla for years and haven't felt a need to find a different client lol. once you install your client, there will be a panel where you put in the info you got from your host to be able to log in. once logged in, there will be a window that displays folders of all your files, and this is where you'll be uploading things. it basically works like a pc file explorer, but... on your host's server. you drag and drop files from your pc into the folders, and they're uploaded to the server. you can also do the opposite and drag and drop things off of the server onto your pc. it might seem intimidating because it's different from using an in-house editor like neocities offers, but it's honestly not so bad once you get used to it

thirdly, you'll want to have bases for your php pages. these are kind of like .html pages, but niftier bc they work together to make a cohesive site, and allow you to customize certain things separately from each other. what find myself always using is a header.php, which is... well, a header. where i have my header stuff like on an html page, call for my css, and if there's something i want present at the beginning of every page, like a navigation menu for example. then an index.php, which functions exactly like an index.html. and finally a footer.php, which is the opposite of the header; the header opens, the footer closes. to use scripts, almost everything is going to take place on pages like this

i made little blank versions of these pages and uploaded them, and i recommend just copying index.php to turn it into what you need for what lol. download the set here

finally, you'll need a zip client, such as winrar to be able to unzip files. winrar is notorious for being used for free despite saying you need to pay lol. if you use the right-click context menu on a .zip or .rar file, and select unzip from there, then you can just... keep using this program indefinitely for free lmao



counter script

ahhh, a common thing from the old web days: the web hit counter. a lot of people still use them on neocities, and they're still kinda nifty! they'll count how many visitors have come to your site, and then display them on the page you place the script on. a lot of sites offer premade counts for free

but what if i told you you could make an entirely custom counter, with your own images? you know... like i have on my neocities pages :,)

what i personally use is graphicookie counter

instructions: there's built-in installation instructions included, but here's how i do it. hopefully this can be helpful ;w;

download the script from their site, and use your zip program to unzip the file into a folder. you're going to want to be in a folder called "graphicookie_counter_1_3", or at least 1.3 is the latest version i have lol. since i have multiple counters on multiple sites, i start by making a subfolder. i then copy the contents of the graphicookie folder into the subfolder

now you'll have a folder with a few different files. the first one should be a folder called "img." copy and paste your custom images into this folder, and for each character name them the number they correspond to

next, there's a file called counter.php. you can open this file with notepad. there will be sections title visitor already came, and a new visitor is coming. underneath these sections will be a list, with things that look like this: "$gcc_aspect/0.png"

make sure that the file type for the images is listed at the type they actually are. the script is looking for .png files, but if you uploaded .gif files, then you need to change each extension to .gif

at the end of the file is a segment called clean html: set image attributes. underneath is some more coding, and the relevant part to look for is akin to this: height="20" width="5"

simply change the height and width to match the dimensions of the images you uploaded, and save the file

there will be a test.php in the folder. open it, and replace everything in it with this:

save the file, exit the folder you made, and drag and drop it onto your host's server in your ftp client

in neocities, go into the page you want to display your counter on, and paste this:

because neocities doesn't normally allow .php files, the .php file where your counter is is being displayed in an iframe instead :,) if your counter is a different size, you might want to tweak the width and height of the display iframe

et voila! you should have a custom counter being displayed on your neocities :)



diary and/or updates script

while we love html, maintaining a diary and/or updates page entirely in html can kind of be a drag lol. doing it all manually by hand kind of takes the fun out of writing a diary entry to me

so i installed cutenews to act as my diary instead of me hand coding it :,)

along with having a rich text editor (think like tumblr), it also allows for uploading of images, custom emoticons, and comments on entries! nifty lil' script, cutenews is

instructions: download the script from their site, and unzip it using a zip program. there will be a folder called, simply, "CuteNews." i recommend renaming the folder to be lowercase or whatever you want it called. i personally just do lowercase because when you're trying to access the folder to make entires, it's case sensitive, so it's easier to type in for a lazy gal like me :,)

upload the cutenews folder to where you want it in your ftp client. there's 400+ files in the folder, so it might take a moment to upload them all. if you're using filezilla it'll make a little "ding" sound to let you know it's all uploaded :,)

once uploaded, go to the url where you uploaded the file. for example, yoursite.byethost.com/cutenews/. it'll immediately prompt you to create and administrator account. set it up with the info you want, and then it should take you to a control panel

there's lots of options in the control panel, but what you're probably gonna be most interested in is system configuration, templates, and integration wizard

because there's so many options and it's subjective to your preferences, all i'll go over in system configuration is how to upload custom emoticons lol. first you'll want to get your emoticons in order. you can honestly use whatever you want, but since these emoticons will display in your entries next to your text, i personally use something smaller. kao-ani has some mega cute sets, and eventually i'll make more pack recommendations :,)

unzip your emoticon pack, and if you want to, rename the files. either way, you're then going to open a notepad file and make a list of all the names of the images in the pack. for example: happy,sad,angry,confused and etc. DO NOT PUT A SPACE BETWEEN THE FILES, and do not use file extensions, just the file name. copy and paste your list into smilies box in your cutenews system configuration and save the changes

next, open your cutenews folder in your ftp client. keep clicking and navigating subfolders in this order > cutenews > skins > emoticons

upload your emoticons into the emoticons folder directly, not in a subfolder

after than, when you go to make an entry in cutenews, it will display your custom emoticons right in the editor!

for templates, you can really customize them however you like. i recommend choosing the premade style you like the least and directly editing it to customize it how you like. i personally like it being simple, with just the date, entry, and comments options. if you want, you can use my template to tinker around with:

active news:

full story:

comment:

add comment form:

news pagination:

comments pagination:

if you use my lil' templates bc i coded them and they're my aesthetic and stuff i'd really appreciate a link back pwease?

finally, you'll want to take the index.php page i provided earlier. copy it, paste it, and rename it something specific. personally i named mine diary. in your cutenews dashboard, give it all the info it asks for, and it'll automatically provide you with a snippet of code to paste in your .php page. upload the .php page to your host's server, and that's where it will display your entries!

another neat thing about cutenews is you can install it in multiple places. let's say you want to use it as an update script. in this case you could make a new /updates/ folder on your server and copy the cutenews folder into it, and set it all up again separately. it'll have entirely separate entries, you can set up a separate page to display the new stuff, and you can even give it a different templates and emoticons. for example, if you use one folder as a diary script, but want to use cutenews as a site update script, or anything else really lol

et voila! you now have a script that will let you make diary entries and/or updates easily in a rich text editor!


back top