"include" function help please

This is a discussion on "include" function help please within the HTML, CSS, and Design Help forums, part of the General category; Hello, im trying to add a calender of events to a right hand side table in the layout.tpl.php and cant ...


Go Back   68 Classifieds Forums > General > HTML, CSS, and Design Help

 
LinkBack Thread Tools Display Modes
  #1  
Old 07-07-2008, 01:07 AM
Senior Member
 
Join Date: Oct 2007
Location: victoria, Australia
Posts: 175
Rep Power: 8
Default "include" function help please

Hello,

im trying to add a calender of events to a right hand side table in the layout.tpl.php and cant get it to work, iv used instructions from http://www.w3schools.com/PHP/php_includes.asp with no joy.

im wonderng if i can 'include' a file from within another folder, ie: does the target file have to be in the same folder as the one calling it?
Reply With Quote
  #2  
Old 07-07-2008, 04:29 AM
Maffo's Avatar
The Master
 
Join Date: Mar 2006
Location: British in Argentina
Posts: 1,389
Rep Power: 40
Default

try using {php}{/php} tags
__________________
Super Mod v4 coming very, very soon

Visit Me @ Classified-Sofware.co.uk

**Important** - All modules with the exceptions of the Bulk Upload System will be removed from my modshop on Tuesday September 30th. If you require a module you must get it before that date.
Reply With Quote
  #3  
Old 07-07-2008, 04:37 AM
Senior Member
 
Join Date: Oct 2007
Location: victoria, Australia
Posts: 175
Rep Power: 8
Default

do you mean like this?

PHP Code:
<html>
<
body>

<
table>
<
tr>
<
td style="vertical-align:top;padding: 1px; border: 3px solid #C4C4C4;" width="100%">
hi
</td>
</
tr>
</
table>

{
php} include("abc/event.php"); {/php}

</
body>
 
</
html
Reply With Quote
  #4  
Old 07-07-2008, 01:36 PM
Senior Member
 
Join Date: Jan 2007
Posts: 105
Rep Power: 10
Default

That should work... the only problem I've had at times with php includes is making sure the location of the include file is correct.

Regards,
Jim
__________________
V3.1.10 Developer
Reply With Quote
  #5  
Old 07-08-2008, 03:09 AM
Senior Member
 
Join Date: Oct 2007
Location: victoria, Australia
Posts: 175
Rep Power: 8
Default

thanks for that Jim, its just not working. Does the target file need a 'prerequisite' (for lack of a better word) to be included this way?
Reply With Quote
  #6  
Old 07-08-2008, 10:47 AM
68 Classifieds Staff
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 4,007
Rep Power: 92
Default

You may want to try using the full path. Something like:
{php} include("/home/user/public_html/abc/event.php"); {/php}
__________________
Eric Barnes
68 Classifieds Developer
Please do not send me a private message asking for support. Instead use these open forums or our ticket system.

Customer Area | Issue Tracker | Documentation | Submit a Ticket | Twitter
Reply With Quote
  #7  
Old 07-08-2008, 06:13 PM
Senior Member
 
Join Date: Oct 2007
Location: victoria, Australia
Posts: 175
Rep Power: 8
Unhappy

all im getting on the browser side is :

{php} include("/home/user/public_html/abc/event.php"); {/php}

the file im trying to include is part of an eloberate calendar script.
if i point the browser directly to the file im trying to include, it shows the calendar, so theres no problem there. i just cant add it to the template files to have it show..
Reply With Quote
  #8  
Old 07-08-2008, 08:10 PM
Chaslie's Avatar
Moderator
 
Join Date: Mar 2006
Location: Great Ocean Road - Australia
Posts: 683
Rep Power: 24
Default

What Eric gave you was an 'example' of a path - it may not be the same as 'your own' actual path. Just checking to see that you understand this?
__________________
Chaslie
V3.1.10 dev
mods.auscity.com
AUSCITY

68 Classifieds Important Links
Customer Area | Issue Tracker | Knowledge Base | User Manuals

HTML Help
W3 Schools
Reply With Quote
  #9  
Old 07-08-2008, 10:11 PM
Senior Member
 
Join Date: Oct 2007
Location: victoria, Australia
Posts: 175
Rep Power: 8
Default

yes, i get that... i wish it were that simple
Reply With Quote
  #10  
Old 07-09-2008, 03:59 AM
Senior Member
 
Join Date: Oct 2007
Location: victoria, Australia
Posts: 175
Rep Power: 8
Default

This is the entire contents of a test.php page with the correct path.

PHP Code:
{php}


include(
"/cal/myevent.php");

{/
php
the folder 'cal' is in the root directory

Should this work?
if i point the browser directly to the file myevent.php i see what i want to see.
if i point it to test.php i see: {php} include("/cal/myevent.php"); {/php}

i must be doing something fundamentally wrong


i think i found the problem, it seems thatyou cant call a file that also uses the include function to call yet another file, unless they are in the same folder...just got to get my head around it..

Last edited by paulsra; 07-09-2008 at 05:48 AM.
Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with search function. Jessej v3.1 Questions & Support 7 04-06-2008 08:27 AM
Import & Bstore function tipud v4 Questions & Support 2 09-24-2007 10:37 AM
Could not instantiate mail function. calaf6 v3.0 Questions & Support 12 02-27-2007 09:38 AM
Where is the custom field search function? MrSpandex v3.1 Modules & Modifications 3 12-08-2006 06:33 PM
Problems with updateOrder function flyingpylon v3.1 Questions & Support 3 11-06-2006 08:58 PM


All times are GMT -4. The time now is 07:08 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22