XF 1.0 Editing Templates and Defining a Callback for Pages

When we debuted the Pages feature, it was intended to be a simple way to get some custom HTML onto a page surrounded by the standard XenForo user interface chrome. By the time we reached Beta 1, it had evolved into an altogether more powerful system.

Pages now support a PHP callback, so your pages can request data from the database and be used as a platform for building any kind of single-page application you might want to build. They also allow you to override the default and specify your own template to be rendered by the page, so the possibilities really are limitless.

This two-part video shows you the basics of building a simple application using the Pages system, and delves into the realms of the template editor to create and edit the custom HTML that will be used to display your page.

To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.

Having built a basic dynamic page, in this second part we add more functionality and data to the page including a sidebar and a list of the authors of the most recent posts. In doing so, we look into advanced template syntax use, and reveal one of XenForo's hidden treasures.

To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.

Part 3
I've just uploaded a third part, answering some questions that have come up:

To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.

... and created a new answer post here:
http://xenforo.com/community/threads/random-questions-answered.114/page-2#post-102179
 
That's a depressing post... but do you think it'd be possible? I'm not all to familiar with WebDAV...
WebDAV is just a protocol that sits on top of HTTP and presents a resource in the form of a file, so you would be able to download all the templates via WebDAV and commit them to SVN from the downloaded location, if you wanted to do that?

I'm not sure of the implementation you have in mind, can you outline how you'd see it working from a user perspective?
 
Anyone know how to connect webdav up on a htaccess protected domain? Seems to be struggling to connect and I didnt really want to remove htaccess auth before we're ready :(
 
WebDAV is just a protocol that sits on top of HTTP and presents a resource in the form of a file, so you would be able to download all the templates via WebDAV and commit them to SVN from the downloaded location, if you wanted to do that?

I'm not sure of the implementation you have in mind, can you outline how you'd see it working from a user perspective?
IMHO it would be "nice" if we could create templates in files while developing add-ons, which aren't stored in the database.
In vB, my developer tools add-on "inserted" all own templates into the templatecache.

(scan add-on template directory, search for .html files, read them and insert them into the templatecache)

On add-on export, the same thing happens again and stores them into the add-on xml file.

The benefits are, you can use a HTML IDE for the html editing and you can use a repository (svn,git) if you're working in an team.

Hope you know what i mean:/
 
IMHO it would be "nice" if we could create templates in files while developing add-ons, which aren't stored in the database.
In vB, my developer tools add-on "inserted" all own templates into the templatecache.

(scan add-on template directory, search for .html files, read them and insert them into the templatecache)

On add-on export, the same thing happens again and stores them into the add-on xml file.

The benefits are, you can use a HTML IDE for the html editing and you can use a repository (svn,git) if you're working in an team.

Hope you know what i mean:/
The issue is that XenForo doesn't use raw HTML templates, they have to go through an extensive compilation process before they are usable, and that is done at save-time.
 
WebDAV is just a protocol that sits on top of HTTP and presents a resource in the form of a file, so you would be able to download all the templates via WebDAV and commit them to SVN from the downloaded location, if you wanted to do that?

I'm not sure of the implementation you have in mind, can you outline how you'd see it working from a user perspective?

As ragtek, mentioned, but since it only represents data AS files and doesn't actually create files, I don't think this would be feasible... :(
 
As ragtek, mentioned, but since it only represents data AS files and doesn't actually create files, I don't think this would be feasible... :(
Creating files to work with is the job of the WebDAV client. For example, Dreamweaver maintains a local copy of all WebDAV assets it's working with.
 
Creating files to work with is the job of the WebDAV client. For example, Dreamweaver maintains a local copy of all WebDAV assets it's working with.

Hm... So if a local copy is kept, it in theory could be incorporated to be in a SVN directory (removing from SVN those that are XenForo default) and if the site is set up correctly, every time you save, SVN notices a change, and marks it as such (it may have to be a separate "project"/site in Coda...) and when its saved, it might auto-upload to XenForo via WebDAV... Mentioning that, it might be feasible, but I'm not 100% sure I could set it up correctly. lol. This is also under the assumption that webDAV files could be uploaded automatically via Local -> webDAV... But I think it could be accomplished. lol. Now, if I had SVN to test this out. lol
 
Anyone know how to connect webdav up on a htaccess protected domain? Seems to be struggling to connect and I didnt really want to remove htaccess auth before we're ready :(
I don't believe that's actually possible, as both htaccess and WebDAV use HTTP Basic Auth.
 
I'm not sure if this is unique to me or not, but to get the WebDAV working on nginx I had to add the following rewrite:

Code:
rewrite ^/admindav.php /admindav.php;

And to access it using PhpED I simply set the hostname to my site domain and the root directory to /admindav.php/
 
Great explanation, thanks for the tips. Very flexible. The webDAV compatibility will save me a lot of errors copying and pasting into a TEXTAREA that I can't resize easily, and isn't syntax highlighted.

Kier, do you find yourself leaning toward Zend Studio for some types of development, and Eclipse PDT for others (or other IDE), or were you just using Zend Studio in these vids because "it was there"?

Just curious.
 
Top Bottom