This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hi all,
Working on a little plugin, i'm searching a way to change the view file to be loaded for requests but seems no way to find how to do it without changing core files. the idea is to have different versions of a same page depending on a parametter or url . .like mobile AMP version or translation /en , /fr etc..
May be someone know how to handle that. Thanks
Last updated
If the page needs to change based on url, you could just create different pages each targeting the required urls. For language based stuff (/en, /de, /fr, etc.), take a look at the Translate plugin. It has a good introduction here if needed.
I'm not sure what your plugin intends to do yet. Some elaboration on what the purpose here is might allow people to be more useful.
Hi,
i'm simply searching to extend / override core classes like it's possible on codeigniter or any other php framework even cms like prestashop to change behaviors as need . I'm trying to create my own translation plugin for personal use.. probably more plugins later but overriding classes is something essential for some fonctionalities and i was surprised to see there is not easy way on octobercms.
concretely , i need now to redefine the fileloader system to change paths / filenames without editing the core files and classes.
Last updated
found it thanks.
i just needed routes.php inside the plugin and probably custom controllers to what i want
If you just wish to make your own Translate plugin, you could extend it however you like. See here https://octobercms.com/docs/plugin/extending.
Or if you just want more control over how you react to urls and what not, you could use Laravel's MVC ways instead of October's MV** philosophy and use of plugin/components. The way to do this would be to use a routes file to handle all routing and then use simple controllers like Laravel does. Example here https://github.com/daftspunk/oc-laravelapi-plugin
herizo.ludovic16552 said:
found it thanks.
i just needed routes.php inside the plugin and probably custom controllers to what i want
lol I just replied with the same solution. Glad you could work it out.
Last updated
Great thanks @pratyushpundir6424 you confirmed the solution and it was very helpfull for me.
1-8 of 8