Basic php to set column width in Joomla
I am using Joomla with bootstrap to create a Joomla template. I have a 3 column layout (container totalling 12 so Bootstrap: span12). I am setting parameters in the Joomla backend to set the $left and $right column widths and then echoing those variables in my template to set the left and right div column widths (in index.php)
However, I want to use a simple bit of logic in my template to automatically calculate and set the span value of the middle column based on the $left and $right values entered in the parameters in the backend.
I literally know almost zero PHP so please forgive me for the crudeness of this code. I just want to check if what I am doing is correct or plain stupid or if there is a better way. Here’s what I am doing…
and then to set the width of my middle column in my html – simply…
Well, that looks like it should work, if you have set the parameters correctly.
You don’t actually say what’s going wrong, i.e. what result is being generated so it’s a bit hard to tell exactly, so here’s some background info and suggestions that may help you figure it out. For template development you can find more at the Joomla Docs website on Template Development.
Assuming your code is in your templates