[1.3.4] Pet Lineages
This tutorial is derived from this thread. The goal here is to modify the breeding system to record pet's lineages (parents), allowing users to keep track of breeding history and/or build a pedigree.
I am not going over making it pretty, that part will be up to you! Database Modification First we're going to start off with getting the database ready for this. In the adopts_owned_adoptables table, add three new columns with the following information: http://img08.deviantart.net/1391/i/2...re-dbdjkff.png classes/class_breeding.php Go into this file and find the line starting like so; PHP Code:
PHP Code:
{home}/breeding.php This is where the bulk of the work is done (aside from making them display all pretty-like). So in public function index find this line: PHP Code:
PHP Code:
Displaying the information Now for the fun part! Wherever you want to display the information (offspring and parents) the code needed will be relatively the same, but it does differ based on whether the file you're editing is a view file or a base file (ex: view/myadoptsview.php vs myadopts.php). In a view file... PHP Code:
PHP Code:
Code; PHP Code:
And that should be it! I know this tutorial isn't very detailed...once you have all of the code it isn't difficult to put it all together...so I hope that it is understandable enough! |
Nice! Thank you :D
|
Bonus code!
Want to show more generations on a pet's page? Easy! Since we already call the parent in a manner that let's us call their information, we can readily do this; PHP Code:
PHP Code:
(maternal grandmother's mother) PHP Code:
So you can create obnoxiously long pedigrees :happycbig: |
I having some trouble with thev view file, where do i put the <strong>Parents:</strong> {$p1name} and {$p2name} tag? and when i put the code in i get a syntax error
|
Quote:
PHP Code:
|
K thanks, but ive run into another issue, when inputting (if num<0) when i insert the code i get a blank breeding.php page. when i take it out the page is normal, is there something off with the code?
|
Quote:
PHP Code:
|
|
Quote:
Do you have error reporting enabled on your host by any chance? It would help pinpoint the problem. |
Okay so, I'm a total noob to coding, could someone give me instructions (for an actual dummy) on where to go to do this?:desudesudesu:
|
Hi,
i had the same problem =/ my breeding is blank. |
Jump bumping this thread because the tutorial is VERY unclear, im not even sure where to put said code on the breedingview page.
|
None of this code goes in a breeding view page (as the breeding view page is the page where breeding happens). You'll either want to make a new page named whatever you want to display the lineage or perhaps shove into the pet profiles. Where you want to display the code is up to you. Most of what the code provided here does is modify the breeding page to save information needed to display a lineage wherever you intend to display it.
|
Quote:
Update: so im running into the old problem i had where the page is blank when i try to breed two adoptables. |
You should see some error messages if the page is blank, cant you ask your webhost to enable error reporting, or configure this yourself? Its more informative and helpful if you can see the error messages.
|
i have error messages turned on, still get a white screen.
|
Can you check the error_log file then? If its not logged on the screen, then maybe its there.
|
ahh ive found the problem, its the displaying them part. I've created a new page called lineage and put the code into it it. how would i intergrade it
|
It's generally designed to just be displayed on a pet profile page/manage page. Don't need to make a new page to display it. The last section of the tutorial covers this :veeee:
|
All times are GMT -5. The time now is 11:56 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.