• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Raw HTML Controller?

Robust

Well-known member
#1
So, is there a way to have a raw HTML controller to display a homepage instead of a formatted response with the page_container and all?

https://xenforo.com
https://xenforo.com/api/

^ those pages are within XF.com's XF installation I think. That's what I attempt to do. I want my homepage to be within the XF framework and port it over, but I don't want it within the header and all.

How can I achieve this?
@Mike @Chris D How did you guys do it here at XF.com?
 

Robust

Well-known member
#4
On another note, I understand views generally, but in XenForo I don't fully understand the purpose of a view. Seems to me like the XenForo template aspect of it takes care of what a view would traditionally do. Can someone explain to me where views are used in XF and what they do? I looked at XF's stock templates and they weren't of much help explaining this.

I had to touch them today to provide json responses.
 

Chris D

XenForo developer
Staff member
#5
So they aren't controllers in XF as such, but initialise XenForo's Application in the pages?
It's sort of an application on its own, which is, for the most part, built using framework code borrowed from or derived from XenForo itself. So it's not an add-on for XenForo, there's not really a normal XenForo installation behind it.

That said, it actually does use the alternative page container thing in a number of its controllers, e.g. the page container used for the home page is not the same as the container used for the manual page, for example.

On another note, I understand views generally, but in XenForo I don't fully understand the purpose of a view. Seems to me like the XenForo template aspect of it takes care of what a view would traditionally do. Can someone explain to me where views are used in XF and what they do? I looked at XF's stock templates and they weren't of much help explaining this.

I had to touch them today to provide json responses.
"View" is really a highly generalised term that really encompasses a range of things, including the rendering of templates, etc. Though if you're talking about View classes specifically they are probably best seen as a final layer between the controller and what is output to the user allowing you to manipulate it as required. It allows us to prepare data to be output as JSON for AJAX requests, it allows us to prepare the data for output as RSS or XML, it allows us to manipulate the response headers so that an attachment file is downloaded vs displaying it as an image within the browser etc.