A simple way to add any content on any place on template

Hi all,

For some time i’m using this trick and i will like to share with you all.

The way of doing this is simple:[list=1]

[*]create a wrapper under skins/[SKIN_NAME]/customer/blocks/wrappers and name it capture.tpl with content

#v3.x ```php
{if $block.user_class}{capture name=$block.user_class}{$content|unescape}{/capture}{/if}

				#v4.x ```php
{if $block.user_class}{capture name=$block.user_class}{$content nofilter}{/capture}{/if}
```<br />
[*]add the block, any type, on admin part under Design/Blocks, choose the position where you wish to appear and [color=#ff0000]you need to select Wrapper and add user class[/color]<br />
									 ![](upload://5ojsWv1Unr1AF8cENiVJT6KKOC0.png)<br />
[*]Now to add the block content on the template just add the code <br />
v3.x ```php
{$smarty.capture.footer_right}
``` <br />
v4.x ```php
{$smarty.capture.footer_right nofilter}
``` *[u][b]footer_right[/b][/u] is the user class and you cand add anything but without spaces, one word.<br />
[/list]<br />
<br />
<br />
I hope that helps,<br />
<br />
Vali

What is the purpose of this? It doesn't appear to be any different to Design>Blocks>Default>Add Block (to any grid)>Create New Block. Create the block, then on any other page or area, Add Block>Use Existing Block, select the previously created block, which inherits the content and styling of the previously created block. Unless I've got the jist of your post completely wrong, of course…?

[quote name=‘StellarBytes’ timestamp=‘1358250908’ post=‘152846’]

What is the purpose of this? It doesn’t appear to be any different to Design>Blocks>Default>Add Block (to any grid)>Create New Block. Create the block, then on any other page or area, Add Block>Use Existing Block, select the previously created block, which inherits the content and styling of the previously created block. Unless I’ve got the jist of your post completely wrong, of course…?

[/quote]



Ok, i am wrong in you opinion.

But what is you solution for this kind of design?





* Why not try? block is the purpose of this post ;)

How are you generating the data to be displayed in your 'Why not try' block? There are built-in Product block types which can achieve similar already.

There are product blocks but you cannot put him in that position ;) using Design/Blocks




  • this is a mix, backend/front end, i hope you understand



    PS:you a programmer?

You don't need to do that, the blocks are very flexible. All you would have to do is rearrange (or should I say recreate) the Grids and (move) the blocks into the appropriate grid. If and when CS-Cart allow the Grids to be moved, the design capabilities will be virtually limitless, you could change your entire site layout in just a few minutes.

Can you give an example?

a print screen of an backend & frontend with your solution?

Simple. Change the Grid Width of the grid containing 'Main Content'. Create a new grid within the same parent grid, add Products block. Done.

backend.PNG

frontend.PNG

Please make a print screen of the frontpage but with product tabs also, and you will see what i have in mind when i did this post, product tabs don’t have a fullwidth ;), they are limited to grid_12

Stellar,



While I'd agree that you could almost do that with the standard block system, how would you do it and keep the tab content wrapping on the bottom? Normally that right grid would extend down and the tab content wouldn't wrap.



This is a pretty cool idea. While I think that the standard blocks would handle most things, this would be a neat way to add content that could be easily edited by the admin to anywhere on the page without having to mess with the grids and blocks.



Thanks,



Brandon

Thanks Brandon,

[quote name=‘Vali’ timestamp=‘1358263496’ post=‘152863’]

Please make a print screen of the frontpage but with product tabs also, and you will see what i have in mind when i did this post, product tabs don’t have a fullwidth ;), they are limited to grid_12

[/quote]

They aren’t always limited to grid 12, they’re limited to whatever Grid width you specify. Grid 12 was used in the screenshots I uploaded if that’s what you mean. Product tabs also wrap, therefore if you have a fixed width of 600px but your tabs take up 700px, the extra tab wraps.



So, now I see it - what your hack does is allows you to place a Block effectively inside the products ‘Main Content’ block.



Good idea, I like it, it’s a useful feature for some but I like to keep things as simple as possible to prevent headaches during upgrades. Not that I should think this will cause any problems, anyway.

I love custom design and i must confess, i never did a update :D, and i think i will not do it in the near future,

is better to start fresh

Wow, I sure can't seem to figure this out and I just don't know what I'm doing wrong.



1.) Created a file in skins/my_skin/customer/blocks/wrappers called capture.tpl In there I put:


{if $block.user_class}{capture name=$block.user_class}{$content|unescape}{/capture}{/if}



2.) I created a block to hold sample products and made it like:



[attachment=6351:sample_products.JPG]



3.) I want this to be in my product details page below my add to cart button, but above my tabs. So in view_main_info.override.tpl below:


{assign var="form_close" value="form_close_`$obj_id`"}
{$smarty.capture.$form_close}




I added:


{$smarty.capture.sample_products}



But nothing is showing up. I've tried moving the last bit all around, but still nothing, no matter where I put it.



Any ideas?



Thanks,



Brandon

sample_products.JPG

Block Sample products must be above of maincontent, please attach a print screen with the admin/blocks/products, and

sample_products without any spaces left or right

Thank you for that. That is probably a very good point to make since it made all the difference. I now have my sample product where I want it:



[attachment=6356:sample.JPG]



Pretty cool.



Brandon

sample.JPG

I am glad that can be on your help :) , if you wish you can PM me to ask something else, but is not time to add them all :(

Could I use this to add block showing the content of product FEATURES along side the product instead of in the tab below the product ?



Looks a nice bit of info.

[quote name='kickoff3pm' timestamp='1358768668' post='153242']

Could I use this to add block showing the content of product FEATURES along side the product instead of in the tab below the product ?



Looks a nice bit of info.

[/quote]

You cannot use my trick to make this change because product FEATURES is not a stand alone block, if you wish you can PM me and i will help you with this request

PM sent V