Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Template Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Using two content boxes with different div styles


Go to End


4 Posts   1212 Views

Avatar
grahamleggat

Community Member, 2 Posts

13 December 2016 at 11:52pm

I'm currently using a content input box to manage a list of links. There are two sets of links, each with a separate heading. At the moment, my client must edit the html to use the correct DIV style, formatting the links correctly. Is there a way to automate this so that links are automatically given the correct div styling?
Any help is much appreciated for this silverstripe beginner! Thanks

http://kalanalysis.com.au/publications/

Avatar
martimiz

Forum Moderator, 1391 Posts

14 December 2016 at 3:23am

I'm seeing some issues with that page, where your user is surrounding the links with H1 headers now? that can't be right :)

Could you provide us with a correct example of how the user is actually supposed to format link and header?

Avatar
grahamleggat

Community Member, 2 Posts

15 December 2016 at 12:51am

Thanks for the reply Martimiz. That is actually my own styling, I'm sure you are right — the current method of styling is a bit of a mess. The current layout and style is correct however, we just need to sort out the backend. Ideally I'd just like to have two content input boxes so that the user can simply add a link and it will be automatically styled using predefined terms. Is this possible? Thanks again!

Avatar
martimiz

Forum Moderator, 1391 Posts

15 December 2016 at 2:09am

Easy way: define a new HTMLText databasefield 'content2' in your pages $db array, and add a HTMLEditorField for it in your pages getCMSFields() function. Tell the user to just add links to them, nothing else :)

Then in your page template something like

<h2>title 1</h2>
<div id="FirstLinkset">$Content</div>
<h2>title 2</h2>
<div id="SecondLinkset">$Content2</div>

Then just style #FirstLinkset a and #SecondLinkset a