Page 1 of 1

Content Blocks within Templates and Linking

Posted: Wed Jul 10, 2013 10:57 am
by zimmo
Firstly, hope I have this in the right place. Secondly how blooming great is cms made simple, just gets better the more I use it and learn new ways to develop.

Right, I have had my first attempt at creating a slider within a template so that my client can add the images via the content editor. This works great and my slider (using jquery) works brilliant.

Now, I want to allow them to link the slides to different urls. I have got this working at the moment where they have to enter the url into a text field in the content block.

What I want to do though is go one step further and allow them to use the CMS Linker and select an internal page to link to rather than an external page or have to enter the URL.

Here is my code for one of the images and the links:

Code: Select all

        {content_module block="first_block_image" label="First Block Image (950px width)" description='For best fit use 950px image width' module="GBFilePicker" tab='Three Blocks Content' assign=firstblockimage mode="browser"}
        {content block='first_block_link' label='More Link (hyperlink)' assign='firstblocklink' wysiwyg="false" oneline="true" default='#' tab='Three Blocks Content'}

Can someone please tell me if this is possible, rather than having to enter the link. If so how.

Thanks and appreciate the comments.
Zimmo

Re: Content Blocks within Templates and Linking

Posted: Wed Jul 10, 2013 2:37 pm
by staartmees
Use Showtime, it does all you need and very simple.

Re: Content Blocks within Templates and Linking

Posted: Wed Jul 10, 2013 2:42 pm
by paulbaker
+1 for Showtime. It gives you transition options, links from each image, text overlay.....sounds like you are on your way to re-writing it?

http://www.web2do.be/Module_Showtime

Re: Content Blocks within Templates and Linking

Posted: Wed Jul 10, 2013 2:57 pm
by zimmo
Thanks for the replies so far. The thing is I use the simple cycle plug in, and I want to learn to use my own rather that rely on a module. This also helps me further develop things and learn.

I know the easy option is to use a plug in.

So any more help greatly appreciated.

Re: Content Blocks within Templates and Linking

Posted: Wed Jul 10, 2013 4:36 pm
by uniqu3
You will not be able to do it with default content blocks, at best you could use "alias" or "content id" as a value of More Link block.
That way you would not need to copy whole URL but simply enter alias or ID
{content block='first_block_link' label='More Link (hyperlink)' assign='firstblocklink' wysiwyg="false" oneline="true" default='#' tab='Three Blocks Content'}
{if !empty($firstblocklink)}{cms_selflink page=$firstblocklink text='Read more' class='my-link-class'}{/if}
Or you could use Extended Content Blocks or AdvancedContent modules, with which you could create a UDT that would return a array of content pages and then use one of these modules to output content block as a Dropdown option.

For example you could use GetAllContent() function from Core API to build your UDT
http://apidoc.cmsmadesimple.org/CMS/Con ... AllContent

Or you can look at ListItExtended module and build your slider with help of that module, which has "Content Pages" field definition so you would have a list of pages available from Module, "Upload File" field definition to upload files or with installation of GBFilePicker and ListItXDefs modules you would have "GBFilePicker Upload" field definition to upload images with GBFilePicker module and everything else is simply just a Template.

Re: Content Blocks within Templates and Linking

Posted: Wed Jul 10, 2013 5:59 pm
by zimmo
Many thanks Goran that explains exactly what I needed to know. I have just purchased the development book for cmsms so looking forward to learning alot more about the system in depth.

Thanks for that. ;D

Re: Content Blocks within Templates and Linking

Posted: Wed Jul 10, 2013 7:42 pm
by Dr.CSS
I would have just used a normal content block= call that would let you pick images then added the link to the image after picking it, this will let them make a link to anything/anywhere...