Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Run vanilla code only and ignore site theme on custom pages
xifekobo
New
hi, I would like to use some vanilla functionalities and would like to create a custom page, ignoring the whole tpl and theme that I currently have.
I have tried this (vjrlinder version), it works but the theme is still loading with it. Any suggestions? thanks.
Tagged:
0
Comments
Looking at Custom Pages, I'd say it is not possible. But what you are trying to achieve is very, very easy:
Save that as /plugins/myPage/class.mypage.plugin.php, enable it and go to yourforum.com/plugin/mypage
Also try yourforum.com/plugin/mypage/Hello
And you should add some more info to the plugin info, but it is not needed...
Thanks @R_J ! One thing is I would like to add more and don't want a plugin for each page, sort of the custom page plugin I guess.
Simply call it myPages
You can add as many
as you like.
You can also do it like that
And if you prefer to see your new pages as "yourforum.com/nicename" you can do it like that:
Since setup() is only run when you enable your plugin, you would have to disable your plugin first an re-enable it afterwards if it is already enabled to see the effect.
I want to point out that you could just request the VIEW instead of the whole page.
Also, I would extend the root controller if you want to create root endpoints instead of adding a route.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
Thanks R_J I will these codes asap!
It would be great if you could post a code example.
This is an important topic and I'm not sure what you mean by that exactly.
I thought you were referring to discussion_render_before at first, but not sure.
I'm not absolutely sure that's what @hgtonight referred to, but this code renders a page that is stored in the plugin's view folder and if you look at the rendered file itself you will see that it is a regular html file (not even php). So in theory you could create many such pages and render them at will.
As explained earlier, the page is invoked through a dispather as shown here. Using the routing merely makes the url friendly.
Here is a snippet for the root controller: https://vanillaforums.org/discussion/comment/231753/#Comment_231753
And here is a live example of "view only": https://vanillaforums.org/discussion/32706/run-vanilla-code-only-and-ignore-site-theme-on-custom-pages?DeliveryType=VIEW
You can also get it as JSON: https://vanillaforums.org/discussion/32706/run-vanilla-code-only-and-ignore-site-theme-on-custom-pages?DeliveryType=VIEW&DeliveryMethod=JSON
You only have to append
DeliveryType=VIEW
and/orDeliveryMethod=JSON
Controllers in Garden have 2 universal parameters that change how a page is rendered.
DeliveryType
determines what gets rendered andDeliveryMethod
determines how it gets rendered. For more information on the specific options available, check out the source code: https://github.com/vanilla/vanilla/blob/1005ef6d2c42ac7c104bc07d44cd58b1a408b1e1/library/core/class.controller.php#L151-L168@R_J posted the exact thing I was thinking: https://vanillaforums.org/discussion/comment/231753/#Comment_231753
Note that you do not have to use the dispatch method. You can just create a method on the root controller (i.e. the name of the function is the important part, not what goes into it).
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
ancillary info.
type and methods.
http://docs.vanillaforums.com/developer/framework/requests/
deprecations.
http://docs.vanillaforums.com/developer/plugins/
Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.