Jump to:

5540 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » add ID to ImageField

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

Page: 1
Go to End
Author Topic: 1350 Views
  • Daimz
    Avatar
    Community Member
    36 Posts

    add ID to ImageField Link to this post

    How do I add a ID to and image feild?

  • joshy
    Avatar
    Community Member
    57 Posts

    Re: add ID to ImageField Link to this post

    What do you mean? For what purpose?

    http://doc.silverstripe.org/doku.php?id=imagefield will tell you about how to create an image field. If, however, you mean on a model level (which you may consider 'database' level), then all fields have IDs. So:

    $has_one = array('Photo' => 'Image');

    Will link an image to the page you're on (calling it Photo). Photo's ID can then be called with $this->PhotoID from within the page it's used.

  • Daimz
    Avatar
    Community Member
    36 Posts

    Re: add ID to ImageField Link to this post

    I mean an ID that I can style.
    I will be adding lots of images over time and I want to give them a specific ID tage which will allow me to style with css.

    1350 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.