JS+CSS for Scrapbook block Custom template
Permalink
Hi,
I have install package "Email List Signup" from marketplace.
I make my own template in folder with these files inside :
- view.php
- view.js
- view.css
I added a scrapbook block of this blockType and set custom template "Footer".
In my theme template, i get this block like this :
All ok in scrapbook listing (custom template applied) but in live website my view.js and view.css is not loaded !
but view.php is loaded !
I specify when i add this block type manually with edit mode, custom template works perfectly.
Can you help me ?
Thanks
I have install package "Email List Signup" from marketplace.
I make my own template in folder
/blocks/email_list_signup/templates/footer/
- view.php
- view.js
- view.css
I added a scrapbook block of this blockType and set custom template "Footer".
In my theme template, i get this block like this :
$nl = Block::getByName('Newsletter'); $nl->display();
All ok in scrapbook listing (custom template applied) but in live website my view.js and view.css is not loaded !
but view.php is loaded !
I specify when i add this block type manually with edit mode, custom template works perfectly.
Can you help me ?
Thanks
I don't know...
Clearer, when we want to display a custom template of a scrapbook block in a theme template, view.js & view.css are not loaded.
Clearer, when we want to display a custom template of a scrapbook block in a theme template, view.js & view.css are not loaded.
you can manually add it to the headerItems.
Example code:
Or try chad's block:
http://www.concrete5.org/community/forums/customizing_c5/a-simple-b...
Example code:
function on_page_view() { $html = Loader::helper('html'); $this->addHeaderItem($html->css('/css/validationEngine/validationEngine.jquery.css')); $this->addHeaderItem($html->css('/css/datePicker/datePicker.css')); $this->addHeaderItem($html->css($this->getThemePath()/css/forms.css')); $this->addHeaderItem($html->javascript('/js/validationEngine/jquery.validationEngine.js')); $this->addHeaderItem($html->javascript('/js/validationEngine/jquery.validationEngine-en.js')); $this->addHeaderItem($html->javascript('/js/datePicker/date.js')); $this->addHeaderItem($html->javascript('/js/datePicker/jquery.datePicker.js')); }
Or try chad's block:
http://www.concrete5.org/community/forums/customizing_c5/a-simple-b...
actually i don't have good understanding in concret5, but i feel that view.css work automatically with the view.php page. But i am not sure about js file. So u just inclued js file manually as Fernandos said. Also one thing you can do is just copy the view.css to the template folder and give name 'defualt.css' and apply this css from custom template, i belive its works fine..
thank you.
thank you.
Is this Possibly a bug??,
I have noticed if I include from the edit page, and whilst in edit mode the css/js is loaded but not when the block is loaded on the site, even if within the scrapbook, you define the custom template.
Not only that but when I try to use the
or
Neither of these include the extra files?,
I am calling the block from the view.php page type
I have tried placing the above code within the controller and using $this but that's not worked either?
I have noticed if I include from the edit page, and whilst in edit mode the css/js is loaded but not when the block is loaded on the site, even if within the scrapbook, you define the custom template.
Not only that but when I try to use the
$controller->addHeaderItem('view.css');
or
function on_page_view() { $html = Loader::helper('html'); $controller->addHeaderItem($html->css('/view.css')); }
Neither of these include the extra files?,
I am calling the block from the view.php page type
I have tried placing the above code within the controller and using $this but that's not worked either?
Im curious now, I have moved all to the header,
on all other pages the css and js are applied, on the single pages, the style is not applied.
This works across the site, but for some reason will not work on any of my single pages??
For now I will add to the main CSS, but its puzzling
on all other pages the css and js are applied, on the single pages, the style is not applied.
<?php $block = Block::getByName('header_nav'); if($block && $block->bID){?> <?php echo "Setting CUSTOM TEMPLATE"; $block->setCustomTemplate('custom-theme'); $block->display(); ?> <?php }
This works across the site, but for some reason will not work on any of my single pages??
For now I will add to the main CSS, but its puzzling
If that's the case, can you just copy the contents of the view.css file that comes with the block and paste that into your theme's css file (assuming your theme's css file is loaded after Loader::element('header_required') in your page type templates), and link to another javascript file from there as well? This would then load on every page, but if you're putting this in the footer of your site you probably want it on every page anyway.
Hopefully someone else knows more about how to make it work the way you want it to, though (I'd like to know myself actually).
-Jordan