Hy,
I'm look for a way to do this on symfony:
I've to use a "box" a bit every where on my site... this box is resizable ... so the html/css is not simple... and i don't want to copy/paste it every where and the content of this box is not constant at all... so its not possible to make a partial template with a object variable... and pass all the content on a variable it's a bit annoying.
someyhing like this would be great:
<?PHP begin("mytemplate") ?>
"html content"
<?PHP end ?>
thanks for your help
Everywhere you need this "box" try this:
include_partial('mymodule/mypartial', array('variable1' => 'value1', 'variable2' => 'value2'));
and in your "mymodule/templates/_mypartial.php" use it like:
<div class="box"><?php echo $variable1 ?></div>
If you don't want to use partials you can use components and define each variable into the component action. Check Symfony's Components Slots (this is for v1.2 but works in v1.4).
Related
If I click on a product from my product overview on the left side, the shop does not load with the list.phtml. As soon as I swap view to grid or list, it swaps to the list.phtml file and everything is fine. But as I said, if I click on the products on the sidebar, it doesnt work (it's not even affected by list.phtml at all). I removed all the code inside it and it still showed (a bit different, that's why I want to change it) the products, but as soon as I swapped mode, everything disappeared -- as it should. Do you know where I can change that?
Thank you.
It should use list.phtml file. In that file it is defined for both list mode and grid mode.
<?php echo $this->getToolbarHtml() ?>
<?php // List mode ?>
<?php if($this->getMode()!='grid'): ?>
<?php $_iterator = 0; ?>
And
<?php else: ?>
<?php // Grid Mode ?>
<?php $_collectionSize = $_productCollection->count() ?>
You can see something like above code in your list.phtml file,one is for list mode and another for grid mode. This is the default case unless you haven't changed the layout or template code.
If you want to know the file location than you can always enable template path hint. If you don't know how to do that you can follow this.
After knowing from which file it is rendering you can fix it.
Hope this will help.
I want to add a new field in virtuemart new product form, how can i do that ?
I add:
var $is_act = 1;
in "components\com_virtuemart\tables\products.php"
And
<?php echo VmHTML::checkbox('is_act', $this->product->is_act); ?>
And in database but what is appear is a checkbox without a string behind it, what is the wrong ?!
The VMHTL::checkbox function just create a check box without strings.
If you want to add string behind it you have to do something like this.
<?php echo JText::_('COM_VIRTUEMART_PRODUCT_IS_ACT') ?>
<?php echo VmHTML::checkbox('is_act', $this->product->is_act); ?>
And then COM_VIRTUEMART_PRODUCT_IS_ACT should be added inside language file too.
for more clearness just check VM default product_edit_information.php page inside
administrator/components/com_virtuemart/views/product/tmpl/
Hope its helps..
I want to make a relatively simple modification to OpenCart so that if there are no Special Offers available, or applicable, that the title Special Offers does not display.
If none are available or applicable, currently it will display the heading title on a coloured background which looks odd if there are no special offers to show.
I am guessing the modification needs to be made to /catalog/controller/module/special.php and would be something like.
If special offers > 0 then do this
else
Don't do anything
But I am not sure how to implement this.
I'd be grateful if someone could advise.
Not entirely sure what you are referring to here, but you would be best editing the template not the controller file and using
<?php if($products) { echo $heading_title; } ?>
in place of what is there currently - something like just <?php echo $heading_title; ?>
Also you may find the title is surrounded by <h1> or <h2> tags. If so, just do the same but around the tags, something like
<?php if($products): ?>
<h2><?php echo $heading_title; ?></h2>
<?php endif; ?>
It's possible to customize the template for different types of content... for example, on homepage: 1 column, on category listing: 2 columns, on single article: 3 columns. In Wordpress it's quite easy, modifying home.php, category.php, single.php.
With what conditionals I can accomplish this in Joomla 1.5?
Thanks
You can conditionally display modules on a page by page basis (based on menu item). You can also assign completely different templates to each page. Furthermore, you can do things like
$option = JRequest::getCmd('option');
$view = JRequest::getCmd('view');
within your index.php and change the page based on the view/component.
Joomla's templating is excellent, with a lot of flexibility.
If only one column contains the real content (componenent/article) you could also work with collapsible module positions. Like this:
<?php if($this->countModules('left')) : ?>
<div class="left_column">
<jdoc:include type="modules" name="left" style="xhtml" />
</div>
<?php endif; ?></code></pre>
Then the presence or absence of modules in this column will determine the layout.
I have an app where I need to call some JS in the onLoad event of the BODY tag of two forms. However, I can't find how to modify the tag for just them. Does anyone know?
Frank
inkedmn certainly has provided the right answer for this case, but in general, you can "hand information up" like this:
(in views/controller/view.ctp)
$this->set('bodyAttr', 'onload="something"');
(in views/layouts/default.ctp)
<?php
if (isset($bodyAttr)) {
$bodyAttr = " $bodyAttr";
} else {
$bodyAttr = null;
}
?>
<body<?php echo $bodyAttr; ?>>
I often use it like this to add extra classes to a "top level element":
<?php
if (!isset($docClass)) {
$docClass = null;
}
?>
<div id="doc" class="<?php echo $docClass; ?>">
You don't need to modify the body tag to have Javascript execute when the page loads. You could just include something like this in your layout where appropriate:
(jQuery)
$("body").load(
function(){
// do stuff when the body element is loaded.
}
);
Or, if you want to have the code execute when the document.ready event fires:
$(function(){
// do stuff when the document is ready
}
);
Or, if you don't want to use jQuery, you could do something like this:
function doStuff(){
// whatever you want to happen when the load completes
}
window.onload = dostuff;
Good luck - and please clarify your question if this answer isn't satisfactory.
I do the following:
We apply $ bodyLoad in my body
<body <? = (isset ($ bodyLoad)? 'onload = \''. $ bodyLoad.' \'',''); ?> >
Already in my [action]. Ctp, I do the following:
<? php $ this-> set ('bodyLoad', 'field.focus ();');?>
If you want you can also put this code in the controller.
Good luck