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.

How do I give a weblog field a html id

April 01, 2008 10:54am

Subscribe [3]
  • #1 / Apr 01, 2008 10:54am

    Lynn F

    29 posts

    Good Morning

    I have a weblog field {picture} that I want to give a html id. So I’d like the code to generate as such with an id.

    picture.jpg

    How do I do this?

    Thanks,

  • #2 / Apr 01, 2008 11:03am

    Mark Bowen

    12637 posts

    Hi Lynn,

    If you mean a CSS id then you can do this quite easily in this way :

    {picture}

    The above code would need to go into an {exp:weblog:entries} tag so that the {picture} variable gets converted into whatever you have stored in that field but that is generally the way to go about it.

    Hope that’s what you meant? If not then let me know and if you can explain step by step what you need and we will see about getting it all sorted for you.

    Best wishes,

    Mark

  • #3 / Apr 01, 2008 11:17am

    Lynn F

    29 posts

    I tried that but it generates part of the html on the screen.  And yes I did mean the CSS.

    image” id=“whatever-you-like-here” alt=“Alternate Text” >

  • #4 / Apr 01, 2008 11:21am

    Andy Harris

    958 posts

    I think you need to change the formatting on your picture field to ‘none’ - I’m guessing it’s set to XHTML at the moment, so will be adding tags at the front and end.

    Though having read your original post I’m not sure this is what you mean. Any chance you can paste the whole block of code in question as I’m not 100% sure what you mean… 😖

  • #5 / Apr 01, 2008 11:26am

    Lynn F

    29 posts

    It’s already set to none.  Thanks though.

  • #6 / Apr 01, 2008 11:46am

    Mark Bowen

    12637 posts

    Do you just have a field in a weblog which just holds the name of the image or are you using the Upload File utility that is in the admin panel to insert the image code. If you have {filedir_x} where x is a number anywhere in it then let us know.

    If you instead just have an image called picture.jpg stored as text in your {picture} custom field then this should be working fine as is.

    Did you ever have that custom field set to XHTML and then changed it to NONE per chance? If so it may be that you missed the preference which appears when you do change from XHTML to NONE at the bottom of the page before you update the field. The preference basically converts all the field data that has previously been store in the entries.

    Let us know first though exactly what you have stored in the {picture} custom field and then we can go from there.

    Maybe some of that might help a bit though you never know! 😉

    Best wishes,

    Mark

  • #7 / Apr 01, 2008 12:16pm

    Lynn F

    29 posts

    Thanks Mark,

    The field in the weblog has “https://ellislab.com/asset/images/team-photo/80261_thumb.jpg” in it as I used the upload file utility to upload it.  It has to stay that way, since my client will be uploading his own pictures in the future.  Not sure about the NONE, but to be sure, I changed it back to XHTML, updated all my templates, and then changed it back to NONE and again, updated the field or template again.

    Lynn

  • #8 / Apr 01, 2008 12:56pm

    Mark Bowen

    12637 posts

    That would be it then. As you have https://ellislab.com/asset/images/team-photo/ in there this is what is throwing the system out.

    You are going to need to (in your template) need to just pull out the 80261_thumb.jpg part of that field so will need to use something like ExtractURL Plus or one of the other plugins available will help you out. With this you will be able to just get hold of the 80261_thumb.jpg part in your template and then create the rest of the image path easily. At the moment if you view the source on what the page is spitting out then you probably have a weird link?

    I am just off home now but will be back online again a bit later but hopefully some of this helps a bit?

    Best wishes,

    Mark

  • #9 / Apr 02, 2008 12:13am

    Lynn F

    29 posts

    Mark,

    Thanks for the hint.  I’m a little new at this so I’ll have to look into plugins.  I’ve downloaded the php file and then I’ll play with it.  I thought this would have an easy answer.

    Wish me luck

    Lynn

  • #10 / Apr 02, 2008 12:33am

    Lynn F

    29 posts

    Mark,

    Worked, first try.  Installed the plugin, followed the directions, and there it was, behaving beautifully.  Actually quite painless.  Thanks again, I suspect this is not the last you’ll hear from me.

    Lynn

  • #11 / Apr 02, 2008 4:52am

    Mark Bowen

    12637 posts

    Hi Lynn,

    No problems. glad you are up and running now.

    See you around some more later.

    Best wishes,

    Mark

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

ExpressionEngine News!

#eecms, #events, #releases