#1
|
||||
|
||||
Encyclopedia
I quickly made this last night as a way to add more depth to pets. Currently it's only for adopts, but it could be used for items as well.
-What this does- This script adds a "bestiary" sort of page where users can find information on your adoptables, like so: It makes the use of public functions, so no need for a separate php file for every entry! -Step 1- Make a new file called encyclopedia.php and paste this inside: PHP Code:
Now go to your view folder and make a new file called encyclopediaview.php and paste this inside: PHP Code:
1. For SITEURL you post your full site url. For example, mine is located at http://adopttest.mysidiahost.com/encyclopedia 2. For PetDirectImageLink you get the image of your adoptable. This can easily be done by right clicking on an adoptable on your site and selecting "open image in new tab". Then copy the full url and paste it in. 3. This script is created to be used with custom tables! You can use the default tables as if you wish though. 4. For public function species_name_here, the name must be the same in both the base php file and view php file or else it won't work! 5. If you wish to add more entries, just copy and paste the same lines of code for each adoptable you want to add! -Example Code- If you require a reference to help you understand the script, here is a part of mine. (It includes my table css) PHP Code:
PHP Code:
And this is an example of how it works:
__________________
Last edited by Dinocanid; 12-29-2016 at 01:11 PM. |
#2
|
|||
|
|||
Thanks was waiting for this :)
|
#3
|
|||
|
|||
was literally just about to try to figure out how to make this :o Thanks!
|
#4
|
||||
|
||||
Ooh, very nice! Thank you! :D
I'm gonna attempt a few modifications actually.. I only have a few species on my site but loads of recolours planned and don't want all the recolours having their own name and instead just using the species name, so I might see if I can add individual pages for all pets....... not sure if it will work, but I can try XD EDIT: Also! You don't need to have your site url anywhere in it. If you put: $document->add(new Comment("<a href='../encyclopedia/vija'>Vija</a>")); [[Put your own species in, etc. XD]] with the dots instead, it links you to the correct url. This is preferred as then if you ever update your url (maybe get paid hosting/domain name) you don't need to edit every single file ^_^ Last edited by parayna; 12-29-2016 at 06:46 PM. |
#5
|
||||
|
||||
I've finally got around to adding this to my site, and I have a quick question! I want the links to be [my site]/archive/[species name]/[id of the species colouration] (the id wouldn't actually be the id if you get my drift... it would just be the number of the entry, and one I manually put in when I write the colours profile and stuff) So like 1 for the first colour I add to the site. (As I don't like each and every colour to have its own special name...) But also this way I can have special designs that DO have a name there instead of the number if it's special enough. But anyways lol...
I have been doing research into public, protected and private functions but I still can't really grasp how I'd do it.. (or if you'd use one of them) I thought it was a protected function but if it is I'm not sure how I'd actually go about making that come after the species name part of the link... >.> Sorry for the trouble ^_^''
__________________
It's been a long time. I had so much fun making a site back in 2016 that recently, when I started thinking about it again, I decided to come back and work on something small. It'll probably just be a personal project but who knows? We'll see, anyway.
|
#6
|
||||
|
||||
I think subpages are one of my weaknesses lol. I've been looking all over google on how to do it, but I can't find any information on it even though it's extremely common. I found nesting functions, but I can't get it to work with the mysidia script.
__________________
|
#7
|
||||
|
||||
Yeah that's where I hit a snag too >.> I was trying to find perhaps examples within the script itself but can't, no matter which file I look in XD I might just be missing it, though... >.>
__________________
It's been a long time. I had so much fun making a site back in 2016 that recently, when I started thinking about it again, I decided to come back and work on something small. It'll probably just be a personal project but who knows? We'll see, anyway.
|
#8
|
||||
|
||||
I put this on Beau's Aviary and it doesn't seem to be working when I click on a pet. It comes up with this.
|
#9
|
||||
|
||||
Looks like you added something wrong. Near the top of encyclopedia.php, it should say "Class Encyclopedia" or something. (Same for the view file, but it would be Class EncyclopediaView) From the looks of it, you have a url there instead.
__________________
|
#10
|
||||
|
||||
Nope, it's fine. No url. For the birds ID's for the URL I put beausaviary.mysidiahost.com/encyclopedia/green_budgie (and the id of the bird changes for each bird). Did I do that part wrong?
|
|
|
What's New? |
What's Hot? |
What's Popular? |