Комментарии:
I have been going back and forth, i decided i prefer my own framework ive built myself.
ОтветитьI want to thank you for the amazing educational content! Thank you so much!
I have a question about the following topic:
In the View class, within the make method, we are returning new static($view); :
public static function make(string $view, array $params = []): static {
return new static($view);
}
However, in the HomeController controller, we are calling the make method in the following way:
public function index() {
return View::make('home');
}
This means that an instance of the View class will always be created. However, in the make method, we are using new static for some reason. But with this usage, when calling View::make('home'), an instance of the class in which this call is made will never be created. So, why do you specifically use new static($view) instead of new self($view) or new View($view)? What are its advantages?
This PHP course is astonishing! Thanks a million!
ОтветитьThe diagram versions was the best actually it helped me a lot to understand for what each of MVC stays for, I have used Laravel a lot and it really covers all this topic, watching the video one time gave me some problems. Thanks a lot GIO. Also please one question about autoloading, Is there any easy way for autoloading using spl_autoload_register() this function or not?
ОтветитьHello, I would love to know differences between PHP frameworks like Laravel and Symphony, you mentioned that Laravel is more than an implementation of MVC and its way more powerful. do you recommend any resources about this topic? or make separate video explaining the differences please. btw the whole course is just marvelous. keep it up!
ОтветитьDon't use that, it is bad. Use file_get_contents and str_replace to avoid variable and buffer contamination.
ОтветитьThis should be everyone's one stop shop for anything relating to PHP. Thank you GIO.
ОтветитьThank you! (comment in support of channel)
ОтветитьHi Teacher , I built upgrade functions View
public function render(bool $IsContent= false) {
$viewpath = VIEW_PATH . '/' . $this->view .'.php';
$template = file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'..\View\view.html');
if ($IsContent) {
$content = file_get_contents(__DIR__.DIRECTORY_SEPARATOR."..\View\\".$this->view.".php");
$template = str_replace('{{content}}' ,$content ,$template);
return $template;
}else {
if (!file_exists($viewpath)) {
echo "VIEW : FILE CONTAIN VIEW NOT AVALBLE OR FORGOT EXTENSION";
}
ob_start();
include $viewpath;
return (string) ob_get_clean();
}
but i dont know how to add navbar for all pages (and this navbar check if user Logined or not )
thanks
ОтветитьGio your tutorials are solid! My son and I are following and everything is working but one piece. We aren't able to get the router to process curly brace vars I couldn't find the router code in your git because this lesson is missing. Where can I find that?
ОтветитьThanks for your useful videos
I also use validations in the controllers and form requests :)
Hello Gio, thank you for this amazing course! Just a quick question: Isn't using ob_get_flush() better instead of ob_get_clean() in this case? According to docs, ob_get_clean() doesn't turn off output buffering. In majority of cases I think it probably doesn't matter since render is the last thing we will be returning, but there could be some problems with multiple renders maybe? Let me know what you think, thanks! :)
ОтветитьWhy are you teaching something that is "not to be used in production", obviously just wasting time. Why not teach something that is usable in production. I am sorry, cannot fathom that.
ОтветитьI just build a project with simple MVC pattern and kinda jump to this video early bcs I wanna know more about the MVC. Now I feels demotivated like I haven't really learn anything.
ОтветитьGio I'm sorry my brain stopped..why does the method render needs to return a string? Amazing series btw.
ОтветитьAmen!
Ответитьi dont understand the new static() return from the make function...is that an anoymous class? what is the reason to return an object
ОтветитьHi Gio, thank you so much for this amazing lesson, u are amazing teacher :)
I have a question please, I decided after finishing this series i will jump into laravel but before that
what if i learn how to create MVC like laravel from scratch, this MVC will have the below
Custom Routing
- Composer
- Controllers
- Views/Layouts
- Models
- Migrations
- Form widget classes
- Processing of request data
- Validations
- Registration/Login
- Simple Active Record
- Session Flash messages
- Middlewares
- Application events
- Framework reusable/installable core
Do you think this will be a good project to put it in my CV and help me to be better PHP DEV??
im loving this serie ... could you share this code ?
Ответитьthanks
ОтветитьThank you.
ОтветитьThis video is a mess e the explanation is boring, feels like a continuation, but the title does not imply that.
ОтветитьIncluding file between ob_start and ob_get_clean is not working, do you think the problem might be in php.ini config? ob_end_flush works instead
ОтветитьThank you so much!
ОтветитьSo thanks gio, you are so help me!
ОтветитьIs this code available to download?
ОтветитьGio thanks for this, the MVC pattern makes a lot of sense. It kinda seems like a lot but it's totally scalable. I'm learning.
ОтветитьThank you for sharing your knowledge. Maybe by chance you have plans to create reliable MVC framework which can be used in production? It is very hard to find reliable content and good practice.
Ответитьis it ok to use ob_start() to include an entire html with a lot of css and javascript animation and return it as a string with ob_get_clean()?
ОтветитьCan you please teach us that how to create a full MVC framework from strach. Would be very helpful. I like your teaching style...
Also please add this functionality in MVC framework like .. how to add elequent Orm And blade template engine...
I have intermediate knowledge of laravel but I want to know how actually laravel work behind the scenes.
Also sometimes I feel that laravel is to heavy framework for smaller projects... That's why I want to build custom MVC framework that has same mvc pattern like laravel and use some of laravel packages that provides orm and template engine packages for easy manipulate database and view..
I really appreciate for your kind tutorial.
Maybe stupid question...
Class View in this code is a Model?
the content is amazing, thank you very much.
ОтветитьThis was an awesome leasson Gio! Much easier to follow after the clear visual presentation at the beginning.
That's it for this week. See you on Monday!
Thanks
ОтветитьThis series is a serious gem
ОтветитьThis PHP course / Bootcamp is amazing
ОтветитьWhen i tried to implement MVC pattern myself sometime ago, at first i did all the validation in controllers, but it looked really ugly with all the validation logic so i moved validation to models. Adding separate layer to handle it sounds like an ideal solution. Your channel is da best btw :DD
ОтветитьThanks for making clear all the differences in diagram versions, when i tried to understand mvc earlier, seeing all these different diagrams was really confusing.
ОтветитьAmazing job and coverage, are you also going to make a seperate lesson on layouts? Thank you for your hard work!
ОтветитьExcelente guía, nosotros también hicimos un tutorial sobre MVC, pero lo adecuamos al uso cotidiano para darle una aproximación mas humana.. pero este que claro de igual manera =)
ОтветитьI made layout.php file (html layout), within the body I have include $viewPath. In the View class I made DEFAULT_LAYOUT constant that points to that layout.php, then in the render method between ob_start and ob_get>clean I include that DEFAULT_LAYOUT. It seems to be working for now, dont know will it cause problems later :)
ОтветитьHello, amazing videos - is possible to download source code for that MVC pattern? thank you
ОтветитьAmazing job!
Ответитьit is perfect.
ОтветитьHi Gio, do you have any paid courses?
Ответить