Home » Forum
NoNumber!

Joomla! Extensions •
Web Development •
Web Design •

I try to respond within 24 hours (excluding weekends). If I haven't responded by then, feel free to post a reminder or bug me via email.
Welcome, Guest
Please Login or Register.    Lost Password?

How to include a file
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: How to include a file
#5172
How to include a file 8 Months, 3 Weeks ago  
Example PHP file:
www.yourdomain.com/myfiles/file.php

{source}<?php
   require_once JPATH_SITE.DS.'myfiles'.DS.'file.php';
?>{/source}

You can also use 'include' (or 'require') instead of 'require_once', but only use that if you need the file included more than once on your page.
If your php file creates classes / functions, having it included more than once will cause errors like "Cannot redeclare class".
Peter van Westen
Admin
Posts: 4280
User OfflineClick here to see the profile of this user
Last Edit: 2010/06/22 00:36 By peter.
The topic has been locked.
Need to contact me directly? Go to my contact page.
If you use any NoNumber! NºNumber!NºNumber! extensions, please post a rating and a review at the Joomla! Extensions Directory.
Are you happy with the support? Please consider buying a License Code to help me to continue development and support.
 
Go to topPage: 1
Joomla Open Source Training