ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Setting a class within an XHTML field

October 03, 2010 1:47pm

Subscribe [4]
  • #1 / Oct 03, 2010 1:47pm

    dbigca

    5 posts

    Hello,
    Is there a way to set the class (or ID) of the containing tag generated by the XHTML field within the template?

    However possible, I’m trying to avoid having my client deal with code.

    I have no plugins installed (yet), using 2.1.0, build 20100810.

    Thanks very much!
    Doug Biggerstaff

  • #2 / Oct 03, 2010 3:10pm

    dbigca

    5 posts

    Hmm, the tag was stripped from my original post.  Let’s try this again…

    I’m trying to add a class to the < p > tag generated by a custom field, formatted as XHTML.

    Is there a template tag for this, or do I need to move to a more robust editor?

    Thanks,
    Doug

  • #3 / Oct 04, 2010 9:48am

    Sue Crocker

    26054 posts

    Welcome to the ExpressionEngine forums, dbigca. I’d probably use one of the available find and replace plugins available from Devot-ee.com. You could do the text replacement in the template, without involving the client.

    Does that help?

  • #4 / Oct 04, 2010 4:24pm

    Carlo Laitano

    99 posts

    You could try using an add-on that allows EE code inside custom fields. I don’t know the exact name, but it’s called something like “Allow EE”. that should help.

  • #5 / Oct 05, 2010 2:42am

    John Henry Donovan

    12339 posts

    Another method would be to create a custom field for the class of the containing tag. It could be a select menu or similar where your client can choose an aptly named class. Btu I am not that familiar with your set-up

    Does any of the above help Doug?

    Wrap your code in <pre><code> tags to stop it disappearing

    Moving this thread to the CodeShare Corner as more appropriate there.

  • #6 / Oct 05, 2010 8:30am

    dbigca

    5 posts

    Thanks very much for all the suggestions!

    I ended up tweaking the CSS to remove the requirement, and using with WYMeditor to gain more control of the internal markup, including the addition of classes, although I’m still exploring that aspect.

    Curious though, Carlo and John, you both indicate that I can use a custom field to set the class.  I’ve tried this - sort of - but ee adds it’s own containing tags, which are not accessible (as far as I can tell), and only visible when HTML is sent to the browser.  What I end up with is nested tags, which messes up my formatting.

    It looks like I’m still missing something, so could you describe the method I should use to access, and target, the inaccessible container tags generated by ee on XHTML fields?

    Thanks very much!
    Doug

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases