Coder Social home page Coder Social logo

Template naming about phreeze HOT 7 OPEN

jasonhinkle avatar jasonhinkle commented on June 20, 2024
Template naming

from phreeze.

Comments (7)

jasonhinkle avatar jasonhinkle commented on June 20, 2024

yes that would work or you can explicitly name the view that you want to be rendered like so:

$this->Render() // <-- this will render a view based on the controller+method name

$this->Render('MyCustomView'); // <-- this will explicitly render a view named MyCustomView.tpl.php

from phreeze.

xtrasmal avatar xtrasmal commented on June 20, 2024

So I could do this:

<body>
<header>
<?php $this->Render('TasksHeaderView'); ?>
</header>
<section>
<div id="container">
<?php $this->Render('PostsContainerView'); ?>
</div>
<aside>
<?php $this->Render('ProjectsAsideView'); ?>
</aside>
</section
</body>

and it would render the view based on the Controller method?

That's great.

from phreeze.

jasonhinkle avatar jasonhinkle commented on June 20, 2024

oh hmm, it doesn't work quite like that. From inside the view you don't have access to Controller methods.

there's a whole bunch of various ways you could do that, either client-side or server-side. The most literal translation of what you have there would be to pull it in using jQuery, maybe something like this:

<body>
<header id="header"></header>
<section>
<div id="container"></div>
<aside id="aside"></aside>
</section
</body>

<script type="text/javascript">
$('#header').load('/taskheaderview');
$('#container').load('/postscontainerview');
$('#aside').load('/projectsasideview');

</script>

This is definitely not the only way. You could also just ->Assign all of the necessary variables on that page. If you look at the ListView templates you can see how they pull in the _header and _footer templates. You could do some combo of both techniques.

from phreeze.

xtrasmal avatar xtrasmal commented on June 20, 2024

Is there a solution that will have the benefit of the long polling?

from phreeze.

jasonhinkle avatar jasonhinkle commented on June 20, 2024

Well, like I was saying there's probably a bunch of ways to accomplish what I can see there from your code. You could use my solution above and just put all of that javascript inside a setTimeout and the page will just keep refreshing. That would work but perhaps would be not very efficient.

Probably a better approach would be to create some backbone models and then bind those to some views on your page.

from phreeze.

xtrasmal avatar xtrasmal commented on June 20, 2024

I will eventually. Today I started version 3 of my first Phreeze app and it's getting more advanced by the version :p
I think that version 4 or 5 will have Backbone relational models and at that point I will give you a copy.

from phreeze.

harinanda avatar harinanda commented on June 20, 2024

any progress with version 4 o 5.can u hare some ode fr us

from phreeze.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.