Welcome Guest, Not a member yet? Register   Sign In
What is the best way to implement the Asset Helper?
#5

[eluser]timpiele[/eluser]
Generally yes, I have one set of global assets I pass in (other than images)...

For images, I create an $images[] array on a per controller basis and pass that to the view and echo out the images like

Code:
<?=$images['logo'];?>

to keep the code simple.

I generally use bootstrap, font awesome, jQuery and a few other libraries project-wide, so they need to be present in the header. I try to keep complex PHP out of my views because my designer has to work with them and it's easier for him to understand

Code:
<?=$css_bootstrap;?>

in the header rather than

Code:
<?php echo css_asset('bootstrap.css');

My question is, other than hard coding calls to the asset helper in the header, is there an easier way (pattern) that you guys use for this, like putting the asset calls in a file and using include() to place it at the top of each controller's constructor, or even just including it in the header I guess?

You've got this block of like 8-10 calls to asset_helper, used on every page, but you don't want them in your header view file, where do you put them?



Messages In This Thread
What is the best way to implement the Asset Helper? - by El Forum - 06-02-2013, 02:14 PM
What is the best way to implement the Asset Helper? - by El Forum - 06-02-2013, 02:50 PM
What is the best way to implement the Asset Helper? - by El Forum - 06-02-2013, 03:33 PM
What is the best way to implement the Asset Helper? - by El Forum - 06-03-2013, 01:29 AM
What is the best way to implement the Asset Helper? - by El Forum - 06-03-2013, 09:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB