Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Thanks to a good steer in this thread I have managed to get an image into an email template that I can package up and put in any org.

My design:

  • Stores the image as a document
  • Uses a component with a custom controller
  • The controller executes a query and gets the ID of the image and
  • The Component then displays the image by doing:

    <apex:component controller="ImageCustomController" access="global">
        <apex:attribute name="height" description="Id for image" type="String"/>
        <apex:image value="{!LEFT($Api.Partner_Server_URL_140, FIND('.com/',$Api.Partner_Server_URL_140)+3)}/servlet/servlet.ImageServer?id={!ImageId}&oid={!$Organization.Id}" height="{!height}"/>
    </apex:component>
    

All brilliant.

However, it is difficult to place something beside my component. In my template, I do:

<div>
<c:ImageComponent height="20"/>
<H1>Performance Insight</H1>
</div>

The image component takes the width of the screen. I want it to behave just like a normal where it is possible to put stuff beside it.

Note: In some cases I want stuff beside and in other cases I won't. So if put the stuff beside it into the actual component I will need to have some logic to know whether to display the extra stuff or not. Is that possible?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

I believe it's because it's rendered into a <div> (which is a block element or whatever is the official name... What I mean is that divs by default occupy 100% width).

Check this explanation for "layout" attribute of <apex:component>:

The HTML layout style for the component. Possible values are "block" (which wraps the component with an HTML div tag), "inline" (which wraps the component with an HTML span tag), and "none" (which does not wrap the component with any generated HTML tag). If not specified, this value defaults to "inline".

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.