View Full Version : include a .php file in showphoto
August 16th, 2010, 01:18 PM
I would like to include a file on the showphoto page.
at the top of the image I would like to add specific info related to the image. so if the image title is called 992 - i would like to call a page called 992.php above the image....
at the min i am using the code
<?php include("/home/sites/vip1895980/httpd/htdocs/$phutitle.php"); ?>
where $phutitle would, in this example be 992.php
nothing is appearing, any ideas on what I am doing wrong? :)
thanks in advance
August 16th, 2010, 01:34 PM
well two aspects here.one would think about when creating such a mod
First off the photo title variable is $title not $phutitle
Second whatever php script you create you would need to alter the showphoto template and include whatever variable you define to output the the html you create in that custom script where you want it to display.
August 16th, 2010, 01:50 PM
ok, i took on board what you said and changed $title for $extra1 which is a custom field that I have added. (namely just the number; in this example it is 992)
When i now add the code
<?php include("/home/sites/vip1895980/httpd/htdocs/$extra1.php"); ?><br /> into showphoto.tmpl nothing appears and when i look at the source i get this:
<?php include("/home/sites/vip1895980/httpd/htdocs/992.php"); ?><br />
I feel I am really close to achieving this... :)
August 16th, 2010, 02:15 PM
I would suspect your not doing something right but your free to discuss code modifications with other users in THE MOD CORNER.
I can not really respond as I would not know what your doing. This is how I would do it.
1. You would include the php file in your showphoto.php file
2. You would alter the actual showphoto template and place whatever variable you have defined to print whatever info you are including where you wish in the template. For example if you have defined in your custom file a variable named $addoninfo then you would place $addoninfo in the template where you wish the info to display.
August 17th, 2010, 06:46 AM
I think I am getting in over my head here...
I have added the code require "$extra1.txt"; to showphoto.php (where $extra1 will become a 3 digit number when the page is loaded) - when the page loads it is including the file :), however it is located at the top left of the page - Point number 2 above is confusing me, I am unsure what to do from here to get the included file displayed where I want it (which is above the photo and below the $nextlink $previouslink)
Thanks in advance.
link below is to the only page that is working, as when different photos are loaded the script is looking to include the relevant .txt file and i haven't created them yet.
992 Go2 Skyblue Scania - NCT Fleetlist Photos (http://www.nctfleet.co.uk/photopost/showphoto.php/photo/47/title/992-go2-skyblue-scania/cat/501)
August 17th, 2010, 07:22 AM
Ok, so after doing some research I think I need to create a php variable which will reside in showphoto.php, I then call the variable in the place i want it to display in showphoto.tmpl... is this correct? :)
August 17th, 2010, 10:59 AM
I feel this now needs to be in the mod corner so I will start a new thread there, thanks for your help so far
August 17th, 2010, 11:01 PM
Yes you would create a php file to generate whatever code you wish and create a variable you can plugin to the showphoto template where you wish but you are correct code modification is not part of product support so the mod forums would be the best place for your discussion.
you could also theoretically do an include inside the showphoto template as well but you need to figure out where you want it to display.
vBulletin® v3.8.1, Copyright ©2000-2014, Jelsoft Enterprises Ltd.