SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2006
    Posts
    89
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Combining backend & template code.

    Hi,

    Right now I have my backend & template code separated in 2 different files. (As per MVC regulations )

    Anyway, since the backend code & template code are always executed together, I was wondering if it's possible to somehow place the 2 on just 1 page.

    Right now I require the template file from with a function of the view class. The template file uses variables assigned to the view class.

    Is there any way to get them together (for performance reasons) since just placing it at the end of the document won't work (uses class variables)

    Thanks

  2. #2
    SitePoint Addict
    Join Date
    Nov 2004
    Location
    London
    Posts
    248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Don't know the answer to your question (sorry!)... but wondered if caching could provide you with the best of both worlds? I.e., you keep your code separate... and users (usually/often) get an all in one (cached) version.

  3. #3
    SitePoint Enthusiast
    Join Date
    May 2006
    Posts
    89
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's a community site so there's always a section that displays whether the user is logged in/out as well as if the user has new private messages etc, so caching is out of the question, unfortunately

  4. #4
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how you do it is going to depend on how your templating code works, but its definately possible.

    if your view class just calls require() on the template file, although its sorta hokey, you could simply paste the contents of the template file into your function.

  5. #5
    SitePoint Enthusiast
    Join Date
    May 2006
    Posts
    89
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, that's a bit too hokey for me Where's my GOTO statement


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
  •