I've been trying this afternoon to simplify my website as the content for each page is separated into loads of tabs which I coud achieve easily if I could just wrap a <div> tag here and there varound things via the richtext editor.
It likes adding classes and spans to <p> tags but that's not what I'm after. I wanted something like this:
So all goes well, I type in the header, select <h1> from the dropdown, then type the sub header, select the text, and use the dropdown and choose <h2>. This leaves me with this:
<h1>Header</h2> <h2>Sub-header</h2>
So now, I select BOTH these lines in the RTE and try and select an all wrapping <div> tag with the id of mainTitleWrapper and it has none of it!? Is there a erason why this wont work? It seems I have to have lots of seperate RTE boxes for each page simply because I have 1 row with no columns, the next one down I might have 3 columns, and the final row beneath that might have no columns again with a macro in it. At one pint I got this, lol:
Can't this all be achieved with one RTE called bodyText if only you could apply <div>s in chosen places. If .mainTitleWrapper is fine in tinyMCE, why not #mainTitleWrapper?
Surely not everyone creates a master template with a large blank square in which they paste the 'bodyText' into, paragprah after paragraph of it. What do people do when the page has different areas of text.
If it is possible, or if you get what I'm even talking about, some help would be most appreciated. Thanks :)
by disabling tidy in the umbracoSettings.config you should be able to achieve this. However I must admit I don't quite get why you don't leave the HTML markup in your templates?
I really should not be neccesary to place div's etc in the RTE - This is a bad practice unless you got a very good reason to do so. There must be another way around this for you.
I've been moving backwards and forwards on this for awhile trying to get a standard way of doing things. I am thinking the same thing as a client could easily mess up the page layout this way if it were all there in the editor. What I'm trying to get at is, my site is very small at the moment, but already I have a host of different templates because each page is a different layout. Most sites have a homepage that looks different, and pages like services/about/contact will use a standard template. So just having one RTE called bodyText (as in the tutorials) wouldn't work for me, because my content doesn't just flow down the page like that, sometimes it's in three columns, sometimes in one. Am I making sense?
I'm having to create a number of doctypes just to hold body content which seems weird, it would really help having some examples of how other people set up sites dotted around the place. I'm sure there is a better and more organised (and time saving) way than the way I'm doing it. I haven't used master/child doctypes yet, maybe that would help me?
No matter the size of the site you must convey to a best practice way of doing things. And havind div's and other layout critical markup in the RTE is not the way forward and not intended in any way. Doing it this way could give you many problems and waste you and the clients time. So don't go down this path :-)
Is it because you require more fields on the document type? Then you can easily add more fields if you need to be able to gain more control over the content and where it should be written in the template.
If the layout differs I don't think that should be that big a problem since it's possible to setup more than one template for a document type. On a document type you can speficy, which templates are allowed to be used on it. Then one of these templates are chosen as the default template, which is the template that would be the most comon used. But on certain nodes you can change the template by going to "properties" and select another template from the template dropdown list.
But maybe you could post a screendump of the different layout's you need to handle? I'm sure no matter how complex they are they can be solved using templates and make some clever usage of CSS.
Thanks for your patience. I'm not trying anything too complex, just trying to set myself good standards from the beginning.
I'm having problems with generic naming I think. If I call a RTE field on the doctype 'row1col1', I can't use that anywhere but on row 1 column 1 on a given page.
Maybe the solution just isn't that simple. I can add more fields but I want a doctype that I can use again and again for sub pages etc so naming conventions must stay relevant. I wouldn't call a css class 'red text' for example because one day you might change the colour, instead I'd call it 'header text' or something which describes what it is, not what it looks like,
I am having problems applying the same to the templates/doctypes.
If I have a page like this, let's say services.aspx:
<-- ROW 1 with 1 column (doctype 'services' field alias row1col1) -->
<-- ROW 2 with 3 columns (doctype 'services' field aliases row2col1, row2col2, row2col3) -->
<-- ROW 3 with 1 column (doctype 'services' field alias row3col1) -->
and another page, contact.aspx:
<-- ROW 1 with 3 colums (doctype 'contact' field aliases row1col1, row1col2, row1col3) -->
<-- ROW 2 with 1 column (doctype 'contact' field alias row2col1) -->
Surely the above could all go on one doctype, after all, it's mainly text, just in different places. I've tried to apply logical naming but it doesn't work as soon as a column doesn't exist or the page is one row shorter than another.
I'm a patient guy and I like to help people out if I can :-)
If I understand what you're trying to explain I guess I would do the following...
For each possible row I would create a tab on the document type so you would have three tabs called
"left content", "center content" and "right content. In each of these tabs I would place a RTE field named "leftContentRte", "centerContentRte" and "rightContentRte".
This can perhaps be placed on a Master document type from, which the Services and Contact document types could inherit these values and then you could assign different templates to these document types, to decide how the content from the fields should be rendered.
By doing so you can make sure that if there has been entered content in a node, which should not be displayed when using the "row1col1" template for instance.
Yes that does help, I think it's going to be something that I fine tune over time. I have it set up like the way you describe already apart from the naming left, right and center).
Now I will experiment with master document types :)
What I'd love is some more functionality, so say I was in the content editor, I'd have the 4 RTE boxes, 'left', 'center' and 'right' and 'fullWidth'. It'd be great if the template was created according to which of these were filled in ie if there was content in the fullWidth one, the content would go across the page accordingly, if there was content in the left only box, the template presumes that it will be a three column layout, something like that. Would make making the pages a whole lot easier!
Would work great as a macro where certain template structures were returned if certain conditions were met.
I've never actually added a macro into the RTE, I tried it earlier but only about 4 of my macros (from about 10) showed up on the list of macros available to add?!
You need to make sure the "use in rich editor/content editor" has been checked on the macro in the developer section under "macros". This should make it appear as one of the macros you can insert. However the above could be solved using templates as well, or one XSLT file for each section etc.
In some cases you should enable this and disable the "show content in editor"...
Thanks that's brilliant! I never even realised you could render a macro straight into the editor - doh! :) So in a hypothetical situation where a template would include the following:
<h1>Header here</h1> (got from a RTE 'headerText' - using umbraco field in a template surrounded by <h1> leaves the <h1> tags even if no content in textstring)
<img src="...." /> (got from a macro)
<p>Description here</p> (from a new RTE 'paragraphText')
<button here> (got from a macro)
So in this example I could use a doctype like so:
1) RTE alias headerText
2) RTE alias paragraphText
and 2 x macros
However, all this could actually be stuck straight into one RTE Making the template:
<umbraco field=RTE> <--------- with everything in there
If the client deletes the macro it should be fairly easy to re-insert it, right? :-) Or even use the "Rollback" function, which appears when you right click on a node. Here you can make a rollback to earlier versions.
So I can't see the problem - it's a matter of educating the client to be savy about it and know what to do if they by accident screw something up :-)
Glad to hear you're inspired and testing what your best practices should be.
Wrapping a div tag around others in RTE
Hi everyone,
I've been trying this afternoon to simplify my website as the content for each page is separated into loads of tabs which I coud achieve easily if I could just wrap a <div> tag here and there varound things via the richtext editor.
It likes adding classes and spans to <p> tags but that's not what I'm after. I wanted something like this:
So all goes well, I type in the header, select <h1> from the dropdown, then type the sub header, select the text, and use the dropdown and choose <h2>. This leaves me with this:
So now, I select BOTH these lines in the RTE and try and select an all wrapping <div> tag with the id of mainTitleWrapper and it has none of it!? Is there a erason why this wont work? It seems I have to have lots of seperate RTE boxes for each page simply because I have 1 row with no columns, the next one down I might have 3 columns, and the final row beneath that might have no columns again with a macro in it. At one pint I got this, lol:
Can't this all be achieved with one RTE called bodyText if only you could apply <div>s in chosen places. If .mainTitleWrapper is fine in tinyMCE, why not #mainTitleWrapper?
Surely not everyone creates a master template with a large blank square in which they paste the 'bodyText' into, paragprah after paragraph of it. What do people do when the page has different areas of text.
If it is possible, or if you get what I'm even talking about, some help would be most appreciated. Thanks :)
Sam.
Hi Sam
by disabling tidy in the umbracoSettings.config you should be able to achieve this. However I must admit I don't quite get why you don't leave the HTML markup in your templates?
I really should not be neccesary to place div's etc in the RTE - This is a bad practice unless you got a very good reason to do so. There must be another way around this for you.
/Jan
Hi Jan,
I've been moving backwards and forwards on this for awhile trying to get a standard way of doing things. I am thinking the same thing as a client could easily mess up the page layout this way if it were all there in the editor. What I'm trying to get at is, my site is very small at the moment, but already I have a host of different templates because each page is a different layout. Most sites have a homepage that looks different, and pages like services/about/contact will use a standard template. So just having one RTE called bodyText (as in the tutorials) wouldn't work for me, because my content doesn't just flow down the page like that, sometimes it's in three columns, sometimes in one. Am I making sense?
I'm having to create a number of doctypes just to hold body content which seems weird, it would really help having some examples of how other people set up sites dotted around the place. I'm sure there is a better and more organised (and time saving) way than the way I'm doing it. I haven't used master/child doctypes yet, maybe that would help me?
Sam.
Hi Sam
No matter the size of the site you must convey to a best practice way of doing things. And havind div's and other layout critical markup in the RTE is not the way forward and not intended in any way. Doing it this way could give you many problems and waste you and the clients time. So don't go down this path :-)
Is it because you require more fields on the document type? Then you can easily add more fields if you need to be able to gain more control over the content and where it should be written in the template.
If the layout differs I don't think that should be that big a problem since it's possible to setup more than one template for a document type. On a document type you can speficy, which templates are allowed to be used on it. Then one of these templates are chosen as the default template, which is the template that would be the most comon used. But on certain nodes you can change the template by going to "properties" and select another template from the template dropdown list.
But maybe you could post a screendump of the different layout's you need to handle? I'm sure no matter how complex they are they can be solved using templates and make some clever usage of CSS.
/Jan
Hi Jan,
Thanks for your patience. I'm not trying anything too complex, just trying to set myself good standards from the beginning.
I'm having problems with generic naming I think. If I call a RTE field on the doctype 'row1col1', I can't use that anywhere but on row 1 column 1 on a given page.
Maybe the solution just isn't that simple. I can add more fields but I want a doctype that I can use again and again for sub pages etc so naming conventions must stay relevant. I wouldn't call a css class 'red text' for example because one day you might change the colour, instead I'd call it 'header text' or something which describes what it is, not what it looks like,
I am having problems applying the same to the templates/doctypes.
If I have a page like this, let's say services.aspx:
<-- ROW 1 with 1 column (doctype 'services' field alias row1col1) -->
<-- ROW 2 with 3 columns (doctype 'services' field aliases row2col1, row2col2, row2col3) -->
<-- ROW 3 with 1 column (doctype 'services' field alias row3col1) -->
and another page, contact.aspx:
<-- ROW 1 with 3 colums (doctype 'contact' field aliases row1col1, row1col2, row1col3) -->
<-- ROW 2 with 1 column (doctype 'contact' field alias row2col1) -->
Surely the above could all go on one doctype, after all, it's mainly text, just in different places. I've tried to apply logical naming but it doesn't work as soon as a column doesn't exist or the page is one row shorter than another.
Does this make sense?
Sam.
Hi Sam
I'm a patient guy and I like to help people out if I can :-)
If I understand what you're trying to explain I guess I would do the following...
For each possible row I would create a tab on the document type so you would have three tabs called
"left content", "center content" and "right content. In each of these tabs I would place a RTE field named "leftContentRte", "centerContentRte" and "rightContentRte".
This can perhaps be placed on a Master document type from, which the Services and Contact document types could inherit these values and then you could assign different templates to these document types, to decide how the content from the fields should be rendered.
By doing so you can make sure that if there has been entered content in a node, which should not be displayed when using the "row1col1" template for instance.
I hope this makes sense and is usefull to you.
Cheers
/Jan
Thanks Jan,
Yes that does help, I think it's going to be something that I fine tune over time. I have it set up like the way you describe already apart from the naming left, right and center).
Now I will experiment with master document types :)
What I'd love is some more functionality, so say I was in the content editor, I'd have the 4 RTE boxes, 'left', 'center' and 'right' and 'fullWidth'. It'd be great if the template was created according to which of these were filled in ie if there was content in the fullWidth one, the content would go across the page accordingly, if there was content in the left only box, the template presumes that it will be a three column layout, something like that. Would make making the pages a whole lot easier!
Would work great as a macro where certain template structures were returned if certain conditions were met.
Sam.
Hi Sam
Well, it should be possible to achieve that by clever use of XSLT and assigning classes depending on what properties have been filled out.
You could create a macro where you could make different test-scenarioes and write out classes depending on what has been filled out.
Then in the macro you want to insert into the RTE you can insert the different sections, if they contain content.
I hope these pointers are enough to give you some inspiration to move further ahead achieving your goal :-)
/Jan
Aha, I think I've cracked the inherited doctype. Will prove most useful!:)
Thanks again Jan.
Sam.
Haha, you're welcome. I guess we just posted at the same time :D
/Jan
Took the words right out of my mouth :)
I've never actually added a macro into the RTE, I tried it earlier but only about 4 of my macros (from about 10) showed up on the list of macros available to add?!
Sam.
You need to make sure the "use in rich editor/content editor" has been checked on the macro in the developer section under "macros". This should make it appear as one of the macros you can insert. However the above could be solved using templates as well, or one XSLT file for each section etc.
In some cases you should enable this and disable the "show content in editor"...
Hope this helps :-)
/Jan
HI Jan,
Thanks that's brilliant! I never even realised you could render a macro straight into the editor - doh! :) So in a hypothetical situation where a template would include the following:
<h1>Header here</h1> (got from a RTE 'headerText' - using umbraco field in a template surrounded by <h1> leaves the <h1> tags even if no content in textstring)
<img src="...." /> (got from a macro)
<p>Description here</p> (from a new RTE 'paragraphText')
<button here> (got from a macro)
So in this example I could use a doctype like so:
1) RTE alias headerText
2) RTE alias paragraphText
and 2 x macros
However, all this could actually be stuck straight into one RTE Making the template:
<umbraco field=RTE> <--------- with everything in there
That sounds like a time saver to me :)
Thanks, will investigate this today.
Sam.
Isn't it a bit dodgy to have a macro in the RTE though with the chance of a client accidentally deleting it or something?
Sam.
Hi Sam
If the client deletes the macro it should be fairly easy to re-insert it, right? :-) Or even use the "Rollback" function, which appears when you right click on a node. Here you can make a rollback to earlier versions.
So I can't see the problem - it's a matter of educating the client to be savy about it and know what to do if they by accident screw something up :-)
Glad to hear you're inspired and testing what your best practices should be.
Happy umbracoing.
/Jan
Thanks, take it easy :)
Sam.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.