MyBB Community Forums

Full Version: Who uses php in templates?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
I'm cool with a couple of foreach statements or whatever to get my HTML rolling. The separation between your app logic and views still exist. Laravel's Blade makes it a little prettier too. Toungue
(2012-09-30, 09:40 AM)Fábio Maia Wrote: [ -> ]I'm cool with a couple of foreach statements or whatever to get my HTML rolling. The separation between your app logic and views still exist. Laravel's Blade makes it a little prettier too. Toungue

A couple of loops, a bunch of conditionals; it ends up turning into a PHP and HTML cocktail. Toungue Personally, I'm not fond of the way it is now, Blade and Twig don't impress me either, they don't consult the underlying problem, they just create an awesome wrapper (maybe that's what people were looking for to begin with). My solution is CaramelCrunch, you benefit from all the awesome templating features we've gotten used to, with the exception of throwing out the cocktail. This gives you awesome looking views, eliminates the hopping between the app and the views to change the way your app works, and makes it easier to work with for a designer.

To answer the OP's question, no I don't. With larger projects it just becomes a giant mess.
Seems php number 1 in whole world! but i can see it same like html
could some one tell me the different between html and php

Best Regrades
(2012-09-30, 06:45 PM)Yahoo Wrote: [ -> ]Seems php number 1 in whole world! but i can see it same like html
could some one tell me the different between html and php

Best Regrades

Using a "car" as an example...

The Server and its software/hardware is the drivetrain.

Php is the body panels...Html is the paint on the body panels.

Php makes something function...Html beautifies it.

Thats how I see it in a most simplest of ways.
One site using this mod, another not Smile

http://php.net/eval
Yes, it makes some things much easier.
I can't believe so many people are saying yes. In the websites I write, I wrote my own template class that you call $t->set("varname", "varvalue"); then in the template file, you just do <?PHP echo $out['varname']; ?>. The only exception is a foreach loop here and there.
I think there is some confusion between php in templates (using echo etc) and using the ZingaBurga plugin for MyBB also called php in templates.

I use template conditionals or I write a plugin/edit a core file using patches.
(2012-10-15, 08:00 PM)spork985 Wrote: [ -> ]I can't believe so many people are saying yes....

One example:
If you want something to show to only certain usergroups, then php in templates (or template conditionals) is an easy, 'perfectly acceptable' way to do it.
(2012-10-15, 08:00 PM)spork985 Wrote: [ -> ]I can't believe so many people are saying yes.

The biggest reason i hate the plugin alternative is:

"You cant edit it easily without disabling the plugin"

Meaning lets say you want to change 1 value in your plugin to include other user groups. You would have to:

>Disable plugin
>Change values
>Enable it again

An while that doesnt seem like much the fact that you have to disable it making anything you do unviewable for a moment makes it a rather big no for me.

Especially if the only thing you do is using:

<if $GLOBALS['mybb']->user['usergroup'] == 1 then> 
  something
</if>
<if $mybb->user['usergroup'] == 1 then> 
 something
</if>

I honestly even find that the template conditions should be a core feature for mybb. Simply for the reason it can make editing small details easier.

Take for example the:

- Show adds to certain user groups.
Pages: 1 2 3