add blocks to template
Permalink
hi there
As most of you know, it is very simple to add the AutoNav block to a template. This is great. I made a simple block to parse xml-data. I would like to add this block also to a page-template. Can anyone tell me, how to add other blocks then the AutoNav block to the template?
Thanks and kind regards,
Steff
As most of you know, it is very simple to add the AutoNav block to a template. This is great. I made a simple block to parse xml-data. I would like to add this block also to a page-template. Can anyone tell me, how to add other blocks then the AutoNav block to the template?
Thanks and kind regards,
Steff
im wondering how to add a editable block via a theme,
like the person can click on it and hit edit.
Any help is appreciated,
Mike
like the person can click on it and hit edit.
Any help is appreciated,
Mike
I don't think this to be possible without hacking a lot. To be editable, the block has to reside in the database and not in the template.
Thank you cgrauer
this helped me a bit further.
This should pass the myLink to my controller.php. Could you please tell me, how to access this now?
Thanks,
Steff
this helped me a bit further.
$bt->controller->URL = 'myLink';
This should pass the myLink to my controller.php. Could you please tell me, how to access this now?
Thanks,
Steff
got it. it's as simple as it can be.
controller.php
view.php
that's the whole thing.
Thank you all.
controller.php
function getURL(){ return $this->URL; }
view.php
$URL = $controller->getURL();
that's the whole thing.
Thank you all.
Note that doing this may cause problems if you want a form in your block -- when I tried this, the $this->action() function would not output anything so my forms were not being submitted back to the controller.
yeah, this is a pain. does $this->action() require a block id in order to work? lately i've been not using $this->action on blocks because of this, and have just been doing the submit logic with the block controller's view method. that comes with another set of problems though (yu've got to manually use the token and have to do some stuff to make it handle multiple instances on the same block on a page).
jordanlev,
thanks for the hint. did you find an other solution to the $this->action() problem?
thanks for the hint. did you find an other solution to the $this->action() problem?
Another trick is to use the tools. An example view.php would be:
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); $tools = Loader::helper('concrete/urls')->getBlockTypeToolsURL(BlockType::getByID($b->getBlockTypeID())); $action = $tools."/my_action_script"; //should be in blocks/myblock/tools/my_action_script.php ?> <form action="<?php echo $action ?>" method="post"> </form>
thank you matogertel.
this could be a way to solve the problem.
by the way. what is the official way to get the variable from an block which is included into a template?
am i using the correct way with this in my controller?
this could be a way to solve the problem.
by the way. what is the official way to get the
$bt->controller->URL('myURL');
am i using the correct way with this in my controller?
function getURL(){ return $this->URL; }
Some blocks need special care because they use data from more than one table, and some need addiditional action (like slideshow for example). You also may use custom templates with render().