Results 1 to 3 of 3

Thread: Theme depending on visitor (normal vs AJAX)

  1. #1
    User
    Join Date
    06-29-09.
    Posts
    271

    Default Theme depending on visitor (normal vs AJAX)

    I need a way to have the markup of a page depend on who is asking. Normal web pages open as usual using whatever theme was set for the page. The same page can also be called by an AJAX function that doesn't need all the markup but would be expecting XML with the content of that page to use inside the already loaded page. :P

    Does TL support this in some way or with an existing extension already? I imagine someone might have written something that can demo multiple theme's on one page structure?

    This way I only need to load from the server what I want, but also get to use whatever page transition I would like to make and have it degrade gracefully as I would build the website like usual initially. :D

  2. #2
    User
    Join Date
    06-29-09.
    Posts
    271

    Default Re: Theme depending on visitor (normal vs AJAX)

    I checked to see if there is a hook to use to change the template used. I found there are two hooks right after the content had been parsed. But there is none before unless I missed it. Leo or anyone else on this?

    Perhaps it would be a nice feature to be able to change the template using a hook?

  3. #3
    User
    Join Date
    06-29-09.
    Posts
    271

    Default Re: Theme depending on visitor (normal vs AJAX)

    The hook generatePage can actually help with the problem because it will allow me to change the template before it is parsed. Event though it is a bit more work then it had to be but the createTemplate function is protected so I had to copy that. I attached the php code for the implemetation of the hook.

    This example relies on a GET variable, but everything can be created.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •