View Full Version : PHP Include in a tpl file
Christoffer Bol
06-19-2006, 03:04 PM
Hello
Can anyone help me out with this? I need to include a php file into one of my pages (in .tpl). I dont want to use iframe..
Try this:
http://www.esyndicat.com/forum/post39695-2.html
Christoffer Bol
06-19-2006, 03:40 PM
Christoffer Bol, you do not have permission to access this page. This could be due to one of several reasons:
Please paste it in a new reply here=)
Hi, please try the following:
*** open header.php and add there the following line ***
include_once("config.php");
use full filesystem path to that file.
then you should add your helpdesk to templates. try to add the following code in the most appropriate place of your tpl files:
{php}include("helpdesk/home.helpdesk.php");{/php}
Use full path also. Let me know if you have problems with this.
This is Simon's instructions for similar question.
If you paid for Pro script you should request access to Pro forum area...
Nick Collins
06-20-2006, 08:59 AM
Please PM your transaction ID, Christoffer Bol, in case you still have no access to the PRO forum.
Christoffer Bol
06-23-2006, 07:44 PM
Dont have it :\ But Simon know im a pro user..
Nick Collins
06-26-2006, 08:47 AM
Hi Christoffer, you have just been added to our pro forum area!
sdawkins
07-14-2006, 04:41 PM
Can someone help me find this code
include_once("config.php");
I see configuration.php, config.inc.php, but no config.php.
Thanks
They were talking about integration with another script. This file does not belong to eSyndicat...
Here is the full thread: http://www.esyndicat.com/forum/showthread.php?p=39695#post39695
sdawkins
07-14-2006, 04:58 PM
thanks, hopefully adding the php file works the way I have it...
Loren
07-27-2006, 09:48 AM
This is Simon's instructions for similar question.
If you paid for Pro script you should request access to Pro forum area...
WTM or Simon
Help me Pleeeeze, i don't understand this coding.:crazy-be:
I have a small calendar for my events i wish to put in my header or footer so it displays in my directory. It gives me these instructions.
MINI-CALENDAR
---------
A file "minical.php" is available for providing a mini-calendar to be embedded in website. It uses overlib support to provide a summary of events in the mini-calendar. To include the mini-calendar in a page, use the following code:
<?php include("minical.php"); ?>
However, note that the mini-calendar also relies on the files used by Calendarix so they are put in the same path. Edit the include paths in "minical.php" if you wish to move the "minical.php" to another location. <<think i have done that bit correct, but it didn't show.
Soooo..looking on the forums i see this and wonder if i could use this instead. And how would i impliment it, as i am rather confused by all the terminology..nothing new there of course :ooi:
#1
Do i put in the header config.php regardless, as per the instructions given like this:
*** open header.php and add there the following line ***
PHP Code:
include_once("config.php");
Or should that be the name of the file? It's also in a folder outside of the directory. So assuming you meant the name of the file, would it be include_once ('spiritmindbody/calendar/mincal.php')
#2 Would it look like this then what i would have to put in my tpl file and is this only to be put in my header.tpl or can i put this anywhere?
then you should add your helpdesk to templates. try to add the following code in the most appropriate place of your tpl files:
PHP Code:
{php}include("spiritmindbody/calendar/minical.php");{/php}
Vincent Wright
07-27-2006, 10:04 AM
Can you send me this minical.php file?
Loren
07-27-2006, 10:59 AM
On its way to you now.
Vincent Wright
07-28-2006, 06:25 AM
Ah, having this file alone I will be unable to test the cal.
I need the whole package. Could you send it to me?
Loren
07-28-2006, 06:45 AM
Sent it petal. Bless You for looking at it for me :good:
Vincent Wright
07-28-2006, 08:30 AM
Received the package. Gimme some time to take a look at it and embed it into my local copy.
Vincent Wright
07-28-2006, 12:05 PM
I installed the Calendarix and played with it a little. Below are the steps to embed it into your eSyndiCat script.
ASSUMPTION 1: My local copy is installed into root folder and yours is in /directory/ folder. This makes difference but I will mention this difference everywhere a correct path is required.
ASSUMPTION 2: You may probably want to install the calendar on the whole site, not only the directory. In this case you will have to tweak it further since I will only show how to do that in directory.
ASSUMPTION 3: I installed Calendarix in a separate folder named [guess it] calendarix/
Ok, let's start...
Step 1
First of all, I had to include minical.php somewhere for the calendar to display. The proper place is template file. I opened footer.tpl and put this piece of code:
{php}
require_once(dirname(__FILE__).'../../calendarix/minical.php');
{/php}
If you installed this cal script in another folder you will have to adjust the path accordingly.
In my GreenLeaves template I put the code so that the cal is displayed in the right most column right below Featured Links box, just FYI.
Don't close the file yet as we will need one more line of code.
Step 2
The script uses overlib.js -- the JavaScript library for displaying pop up tooltips when you move your mouse over elements like <a> or <div>. I revealed that a tooltip appears when you hover your mouse over a day in your cal with an event assigned to it; the tooltip displays event's title.
For now we have to set up a correct path to this library since the default installation renders this path invalid. That's why I got JavaScript errors when I tried to move my mouse over the sample event.
Well, in the footer.tpl (which should be still open) I added the this line right before closing </body> tag:
<script type="text/javascript" src="/calendarix/overlib.js"></script>
But since my directory is installed in root and yours in directory/ subfolder you have to add this line (still assuming that cal installation folder is calendarix/ ):
<script type="text/javascript" src="/directory/calendarix/overlib.js"></script>
Save changes and close the file.
Now open minical.php. The author attempted to added the path to the overlib.js in the minical.php but, first of all, your calendar might be put into <td> or <div> element which is not valid HTML since adding <script> inside <td> or <div> is not allowed. Second, the path is anyway invalid. So, just remove the line below:
<script language="JavaScript" src="<?php echo $urlpathtocal.'overlib.js'?>" type="text/JavaScript"><!-- overLIB (c) Erik Bosrup --></script>
Save changes.
Now refresh your directory page. Try to hover the mouse over an event (by event here I mean a day in your cal) and see what happens.
Step 3
Now if you try to move your mouse over links at the bottom of the cal that read like this: << July 2006 >>, you will see that the links are invalid.
First, I fixed the "July" link at the top. Find this line (starts on line #72):
echo "<a class=smallcalmth href=\"".$urlpathtocal."calendar.php?op=cal&month=".$smmonth."&year=".$smyear."\" target=_BASE>" ;
and replace it with
echo "<a class=smallcalmth href=\"/directory/calendarix/calendar.php?op=cal&month=".$smmonth."&year=".$smyear."\" target=_BASE>" ;
Save the changes and refresh dir page. Try the July link -- it should work now.
Now let's fix the << and >> links.
<< means "go to the same page (category, listing, link details, whatever), but display previous month in the calendar", e.g. if you see July displayed, clicking << will display June, leaving all the other content intact. At least this is how I see it should work. The same with >>. So I modified the minical.php accordingly.
At first modifing these urls may seem simple at first glance, but turns out to be a little bit tricky. You cannot simply append ?date=xx-xx-xxx since it will render the url invalid in some cases. E.g. you already have date=xx-xx-xxxx appended to your url (i.e. you already clicked the <<). Appending it the second time is definitely not what you want. In this case you want replace the original date with the new one. Etc., etc.
Well, find the this piece of code (actually I cannot tell what the original line # is since I edited the file):
if (date("Y",mktime(0,0,0,$smmonth-1,1,$smyear))>=$calstartyear)
echo "<a class=smallcalmth href=".$_SERVER['PHP_SELF']."?date=$pdate><<</a>";
right before it insert this snippet:
$purl = $_SERVER['REQUEST_URI'];
if (preg_match('/^.*date=[0-9\-]+.*$/i', $purl))
{
$purl = preg_replace('/date=[0-9\-]+/i', 'date='.$pdate, $purl);
}
else
{
if (strpos($purl, '?'))
{
$purl .= '&date='.$pdate;
}
else
{
$purl .= '?date='.$pdate;
}
}
This code generates valid "previous" url. Now you have to replace original url with this one.
In the snippet above replace
echo "<a class=smallcalmth href=".$_SERVER['PHP_SELF']."?date=$pdate><<</a>";
with
echo "<a class=smallcalmth href=".$purl."><<</a>";
You are now done with "previous" link. Let's do the same to the "next" link.
if (date("Y",mktime(0,0,0,$smmonth+1,1,$smyear))<=date("Y")+$caladvanceyear)
echo "<a class=smallcalmth href=".$_SERVER['PHP_SELF']."?date=$pdate>>></a>";
Right above this piece of code add the following:
$purl = $_SERVER['REQUEST_URI'];
if (preg_match('/^.*date=[0-9\-]+.*$/i', $purl))
{
$purl = preg_replace('/date=[0-9\-]+/i', 'date='.$pdate, $purl);
}
else
{
if (strpos($purl, '?'))
{
$purl .= '&date='.$pdate;
}
else
{
$purl .= '?date='.$pdate;
}
}
Now replace
echo "<a class=smallcalmth href=".$_SERVER['PHP_SELF']."?date=$pdate>>></a>";
with
echo "<a class=smallcalmth href=".$purl.">>></a>";
Now save the changes and close the file.
--
Phew! I cannot believe I had patience to write this long long post :jokingly:
If you have any problem applying this just ask me for help.
redeye
07-28-2006, 12:33 PM
Sterling piece of work Vincent :1st:
Now all we need is for Her Majesty to let us see it in action -_-
Vincent Wright
07-28-2006, 12:36 PM
Yeah, I really want to see this in action on her site.
Loren
07-28-2006, 02:43 PM
Oo i am so excited! Thank you so much Vinny for spending your precious time on this to help me out, i really do appreciate it..and I shall definately play with this later..and report back on how it goes.
As for you Red, Her Majesty indeed :lol: It will be off with your head if you don't behave ;)
That should keep you busy for awhile Loren. No vino while doing the editing :D
Great instructions Vincent ;)
Loren
07-28-2006, 05:10 PM
That should keep you busy for awhile Loren. No vino while doing the editing :D
Great instructions Vincent ;)
Cheeky Monkey...Hell i need the vino while editing..it's when i am sober i have the problem! :D
Cheeky Monkey...Hell i need the vino while editing..it's when i am sober i have the problem! :D
Cheeky Monkey ? Where do you come up with these. :D
Well if the vino doesn't work there's a new moderator that might share his "wacky weed" with you. :smoke:
(like the new avatar, best yet) ;)
Loren
07-28-2006, 05:45 PM
Cheeky Monkey ? Where do you come up with these. :D
Well if the vino doesn't work there's a new moderator that might share his "wacky weed" with you. :smoke:
(like the new avatar, best yet) ;)
No I would pass on that don't do wacky weed, or hard drugs of any recreational nature...apart from smoking, alcohol and not on a daily basis either, and the occassional valium to steady the nerves...hey what can i say, i am only human :D
As for Avatar Bless you Petal..my son took it this afternoon, after i had been to hairdressers, thought it about time i had an up to date one..especially for my site! There's a bigger one there..
redeye
07-28-2006, 05:57 PM
I went to the barbers today for a quick polish :cool-yo:
Loren
07-29-2006, 01:38 AM
I went to the barbers today for a quick polish :cool-yo:
Red, the glare is blinding me! Cover it up will you... ;)
Well, it's nearly 2.30am and after only a short time I now have a my mini calendar! Bless You Vinny :kiss: It worked like a dream..and i appreciate your well set out instructions, and of course your patience in writing them down so succinctly for me..
...just gotta shrink it now to fit page, and that is like looking for a needle in a hay stack...sure i will find it at some point..
So this diversion from the original may well be useful for anyone else wishing to install this free calendar..might be idea to put this lot in a thread on its own.
Nite all
Vincent Wright
07-29-2006, 06:09 PM
I'm glad my instructions helped and you were able to install the minical.php.
I forgot to mention CSS issue. The Calendarix comes with its own themes (that include CSS files). I tried to use it along with eSyndiCat CSS files. They seem to conflict so my advice is not use them. Instead you can lookup what styles are set in minical CSS and duplicate them in eSyndiCat CSS.
Loren
07-29-2006, 07:09 PM
I'm glad my instructions helped and you were able to install the minical.php.
I forgot to mention CSS issue. The Calendarix comes with its own themes (that include CSS files). I tried to use it along with eSyndiCat CSS files. They seem to conflict so my advice is not use them. Instead you can lookup what styles are set in minical CSS and duplicate them in eSyndiCat CSS.
Thanks for the advice..have done that, but thats another thing to do on my todo list :)
Vincent Wright
07-30-2006, 06:31 AM
I checked your site -- the calendar fits well except for the text being a little bit (imho) larger than the text elsewhere.
Loren
07-30-2006, 07:56 AM
I checked your site -- the calendar fits well except for the text being a little bit (imho) larger than the text elsewhere.
Yes exactly what i meant, i need it to be inline with the rest, and width needs to be the same as it's pushing the elements there out a bit..
...as for text i have changed the values, and i noticed the problem if you rely on their css it changes my whole page rather than just the calendar but i copied and pasted some css into my directory css file, which solved that problem and will at some time try and find out why even though i have reduced the text sizes in css, what little critter is not changing them on my calendar...:wallbash:
O Well get there eventually...
Loren I haven't looked at the page in ? yet But maybe if instead of class="whatever" you could use an id="whatever" in the css for that part of the calendar.
#whatever{
color:#999999;
font-size:1.0em;
}
Just a guess. :)
Yes that true..shall have a look at it..boy you are doing a lot of walking you making me tired watching you!
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.