Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

extends [file] ?

General discussions related to php

Moderators: macek, egami, gesf

extends [file] ?

Postby adahox » Thu Jul 11, 2013 7:11 pm

hello,

how can i extends some class in other file?

exemple.
file one.php
Code: Select all
class One{}

file two.php
Code: Select all
class two extends one{}


how can i do it?

thanks fo all.
adahox
New php-forum User
New php-forum User
 
Posts: 4
Joined: Thu Jul 11, 2013 7:07 pm

Re: extends [file] ?

Postby johnj » Thu Jul 11, 2013 10:58 pm

first include that file in your second file. Take a look at the include(), require_once() etc
http://php.net/manual/en/function.include.php
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: extends [file] ?

Postby adahox » Fri Jul 12, 2013 4:03 am

i want do it without include_once, require or someting like.

i want do someting like cake. the controller call appcontroller class without include. get it?

thanks for all! :D
adahox
New php-forum User
New php-forum User
 
Posts: 4
Joined: Thu Jul 11, 2013 7:07 pm

Re: extends [file] ?

Postby johnj » Sat Jul 13, 2013 6:02 am

Whether you use include() or cake, the parent class has to be visible to the child for it to extend or inherit - there are no shortcuts here.
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: extends [file] ?

Postby adahox » Sat Jul 13, 2013 12:56 pm

:offtopic:
adahox
New php-forum User
New php-forum User
 
Posts: 4
Joined: Thu Jul 11, 2013 7:07 pm


Return to PHP General

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.