View previous topic :: View next topic |
Author |
Message |
cobex4 Smarty Regular
Joined: 02 Sep 2008 Posts: 74
|
Posted: Fri Oct 22, 2010 9:11 am Post subject: Personal Class in TPL |
|
|
Hello,
In TPL, how it uses a class personal ?
Exemple :
<?php
exho text::p('test');
?>
Tanks. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Fri Oct 22, 2010 2:10 pm Post subject: |
|
|
Static class access is much like in PHP.
|
|
Back to top |
|
cobex4 Smarty Regular
Joined: 02 Sep 2008 Posts: 74
|
Posted: Fri Oct 22, 2010 3:03 pm Post subject: |
|
|
No work
PHP Fatal error: Class 'p' not found
In php, work.
PS :
My classes are automatically loaded
Code: | function __autoload($class_name) {
require_once 'classes/' . $class_name . '.php';
} |
Last edited by cobex4 on Fri Oct 22, 2010 4:26 pm; edited 1 time in total |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
|
Back to top |
|
cobex4 Smarty Regular
Joined: 02 Sep 2008 Posts: 74
|
Posted: Fri Oct 22, 2010 4:21 pm Post subject: |
|
|
yes yes smarty 3 rc4 |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Fri Oct 22, 2010 4:33 pm Post subject: |
|
|
did you fix your autoloader? |
|
Back to top |
|
cobex4 Smarty Regular
Joined: 02 Sep 2008 Posts: 74
|
Posted: Fri Oct 22, 2010 4:50 pm Post subject: |
|
|
Code: |
function __autoload($class_name) {
require_once 'classes/' . $class_name . '.php';
} |
I have this code before loading Smarty |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Fri Oct 22, 2010 4:59 pm Post subject: |
|
|
Don't use __autoload. You must register your autoloader with spl_autoload_register.
Code: | function myautoload($class_name) {
if (file_exists('classes/' . $class_name . '.php') {
require_once 'classes/' . $class_name . '.php';
} else {
return false;
}
}
spl_autoload_register('myautoload');
|
|
|
Back to top |
|
cobex4 Smarty Regular
Joined: 02 Sep 2008 Posts: 74
|
Posted: Fri Oct 22, 2010 7:25 pm Post subject: |
|
|
Yesssss, A big big big thank you |
|
Back to top |
|
|