Fetching the contents of an Image Placeholder

254 views
Skip to first unread message

VegeJuice

unread,
Oct 9, 2008, 9:28:54 AM10/9/08
to RedDot CMS Users
We're trying to get the source URL of an image placeholder using
render tags. None of the usual suspects do the job
Page.Elements.GetElement(img_Main).Value,
Page.Elements.GetElement(img_Main).GetHtml()

Has anyone found a suitable method?

VJ

Henry Lu, Sun Certified Java Programmer

unread,
Oct 9, 2008, 1:23:35 PM10/9/08
to RedDot-C...@googlegroups.com
The src="xxxx" should be within the <img /> tag you get from calling
GetHtml().

Is it not there?

Henry Lu

VegeJuice

unread,
Oct 10, 2008, 12:25:43 AM10/10/08
to RedDot CMS Users
GetHtml() returns blank for an image...

VJ

Rob

unread,
Aug 2, 2012, 12:47:30 PM8/2/12
to reddot-c...@googlegroups.com, RedDot CMS Users
Anyone,
 
Now we got the GetHTML() to work. 
 
We still want to access the SRC attribute of the IMG placeholder directly using Render Tags.  We don't want to check "Insert path and file name only" since this placeholder is used on the page and parent page with the ALT attribute.  We don't want a workaround that requires the editor to do more work, such as having a separate standard field placeholder for the ALT value and combining the values by providing the IMG tag HTML.
 
Anyone know a solution using Render Tags?
 
Rob

On Wednesday, August 1, 2012 6:42:34 PM UTC-4, Rob wrote:
VJ,
We need to do the same thing.  And the GetHTML() is not working at all.  How did you work this out?
 
Anyone,
Do you have a solution for this?
 
Rob 

Jian Huang

unread,
Aug 2, 2012, 3:01:22 PM8/2/12
to reddot-c...@googlegroups.com, RedDot CMS Users
Hi Rob,

Can you use a list or dynamic anchor to pull the img placeholder through?

Using rendertag is not really recommended for performance and a known bug reason.

-Jian

Rob

unread,
Aug 3, 2012, 11:54:43 AM8/3/12
to reddot-c...@googlegroups.com, RedDot CMS Users
Jian,
 
We prefer not to create the IMG placeholder in a list or dynamic anchor.  It is one of several images the editor must provide on the page and we don't want to make their interaction with SmartEdit more involved/complicated/different for this one image.
 
If I understand your idea correctly, it is to pull the IMG through the list, defining the placeholder as "Insert path and file name only", and getting the URL easily that way.  But we are trying to access this placeholder on the same page it needs to be defined without "Insert path and file name only" checked.  Please let me know I understand you correctly and this is not a viable option.
 
I think we don't mind the slower performance on this page.  Publishing can run slower.  I will verify SmartEdit is running fast enough. 
 
What is the known bug on this?
 
Do you know a way to use Render Tags to directly access this IMG attribute?
 
We are needing this to publish a reference to the image in a line of HTML in the HEAD for the Facebook Like button to pick the right image. 
 
Rob

Jian Huang

unread,
Aug 3, 2012, 1:29:41 PM8/3/12
to reddot-c...@googlegroups.com, RedDot CMS Users
Hi Rob,

Yes, so you have the placeholder on Page A, and pulling the placeholder via list or dynamic anchor on Page B.  Placeholder can have regular setting on Page A, and have "insert path and file name only" on Page B.

Getting element info via rendertag has this rendertag cache issue.  Element info retrieved via rendertag will not get updated when targeted element has changed.

-Jian

Rob

unread,
Aug 7, 2012, 5:11:51 AM8/7/12
to reddot-c...@googlegroups.com, RedDot CMS Users
Jian,
 
The page I need this flexibility on is a detail page where the image placeholder is assigned content (including "alt" attribute) and where the URL of the image is needed to pass on to Facebook for a Like click.  By that description, I think I am stuck.  I need access to the placeholder both ways on the same page level.  Even if I forced the editor to add this image on a lower page as a list item or dynamic anchor item, I still can't read the placeholder two ways on the same page using just RedDot placeholders.
 
I am considering light compromises to get a solution.  Perhaps the editor could have a more cluncky interface or series of steps.  Use RQL (oh no!).  Or some other less elegant solution.  I don't want the editor to need to enter the image twice.
 
Is there a way our content editors could refresh this cache after an image change?  If not, could our developers do it?  How?
 
When is the cache problem encountered?  For just GetElement() method?  All methods accessing only Content Elements?  Only Structural Elements?
 
Sounds like GetElement is rather useless. 
 
Is there another way to access this image HTML you know of for me to parse out the URL?  I doubt I can use VBScript within PreExecute on the image placehlder HTML.  The way it is processed, it will cause an error.  PHP could do it but it is not available to me on this project.
 
Rob
 
 

Gavin Cope

unread,
Aug 7, 2012, 5:24:45 AM8/7/12
to reddot-c...@googlegroups.com
I wonder if you could use Tip 3 in this article: http://www.reddotcmsblog.com/3-quick-tips-for-opentext-web-content-management-or-reddot-cms
to achieve the desired result? Placeholder as insert file name only then build the code you need in each instance around it?

Not sure if it'd work, just thinking out loud.

Cheers,

Gavin

 
Rob
 
 

--
You received this message because you are subscribed to the Google Groups "RedDot CMS Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/reddot-cms-users/-/ZIe4cnUuYtoJ.

To post to this group, send email to reddot-c...@googlegroups.com.
To unsubscribe from this group, send email to reddot-cms-use...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/reddot-cms-users?hl=en.

Richard Hauer

unread,
Aug 7, 2012, 7:11:58 AM8/7/12
to reddot-c...@googlegroups.com
Also thinking out loud, how about a custom render tag to process the image tag?

Sent from my Windows Phone

From: Rob
Sent: 7/08/2012 19:11
To: reddot-c...@googlegroups.com
Cc: RedDot CMS Users
Subject: Re: Fetching the contents of an Image Placeholder

Richard Hauer

unread,
Aug 7, 2012, 7:14:42 AM8/7/12
to reddot-c...@googlegroups.com
Or... 2 image tags, one set to "URL only" where one references the other? You can preassign the reference I believe.


Sent from my Windows Phone

From: Richard Hauer
Sent: 7/08/2012 21:11
To: reddot-c...@googlegroups.com
Subject: RE: Fetching the contents of an Image Placeholder

Jian Huang

unread,
Aug 7, 2012, 1:26:56 PM8/7/12
to reddot-c...@googlegroups.com
Had the same problem just 8 months ago.

Pre-referencing cannot be done on content elements that are in the same content class.  Had to write a little plugin that automatically reference image element to another element of the same page upon page creation.

-Jian


On Tuesday, August 7, 2012 7:14:42 AM UTC-4, Richard Hauer (5 Limes) wrote:
Or... 2 image tags, one set to "URL only" where one references the other? You can preassign the reference I believe.

Sent from my Windows Phone

From: Richard Hauer
Sent: 7/08/2012 21:11

Subject: RE: Fetching the contents of an Image Placeholder

Also thinking out loud, how about a custom render tag to process the image tag?

Sent from my Windows Phone

From: Rob
Sent: 7/08/2012 19:11

Cc: RedDot CMS Users
Subject: Re: Fetching the contents of an Image Placeholder

Jian,
 
The page I need this flexibility on is a detail page where the image placeholder is assigned content (including "alt" attribute) and where the URL of the image is needed to pass on to Facebook for a Like click.  By that description, I think I am stuck.  I need access to the placeholder both ways on the same page level.  Even if I forced the editor to add this image on a lower page as a list item or dynamic anchor item, I still can't read the placeholder two ways on the same page using just RedDot placeholders.
 
I am considering light compromises to get a solution.  Perhaps the editor could have a more cluncky interface or series of steps.  Use RQL (oh no!).  Or some other less elegant solution.  I don't want the editor to need to enter the image twice.
 
Is there a way our content editors could refresh this cache after an image change?  If not, could our developers do it?  How?
 
When is the cache problem encountered?  For just GetElement() method?  All methods accessing only Content Elements?  Only Structural Elements?
 
Sounds like GetElement is rather useless. 
 
Is there another way to access this image HTML you know of for me to parse out the URL?  I doubt I can use VBScript within PreExecute on the image placehlder HTML.  The way it is processed, it will cause an error.  PHP could do it but it is not available to me on this project.
 
Rob
 
 

--
You received this message because you are subscribed to the Google Groups "RedDot CMS Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/reddot-cms-users/-/ZIe4cnUuYtoJ.
To post to this group, send email to reddot-cms-users@googlegroups.com.
To unsubscribe from this group, send email to reddot-cms-users+unsubscribe@googlegroups.com.

Jian Huang

unread,
Aug 7, 2012, 2:31:57 PM8/7/12
to reddot-c...@googlegroups.com, RedDot CMS Users
Hi Rob,

Preexecution fails because of the " inside the <img> tag, unless you using ' in your preexecution, then it is variable = '<img src="...."'.

PHP, same problem.

How about JQuery/Javascript that does it client side rather than server side?

$("img.like").attr("src")

you can provide class to image by going into image placeholder property and go to supplement section, type in class="like"

-Jian

Richard Hauer

unread,
Aug 7, 2012, 8:21:20 PM8/7/12
to reddot-c...@googlegroups.com

Fair enough – maybe share the plugin?

 

Regards,

Richard

 

From: reddot-c...@googlegroups.com [mailto:reddot-c...@googlegroups.com] On Behalf Of Jian Huang
Sent: Wednesday, 8 August 2012 3:27 AM
To: reddot-c...@googlegroups.com
Subject: Re: Fetching the contents of an Image Placeholder

 

Had the same problem just 8 months ago.

To post to this group, send email to reddot-c...@googlegroups.com.
To unsubscribe from this group, send email to reddot-cms-use...@googlegroups.com.


For more options, visit this group at http://groups.google.com/group/reddot-cms-users?hl=en.

--

You received this message because you are subscribed to the Google Groups "RedDot CMS Users" group.

To view this discussion on the web visit https://groups.google.com/d/msg/reddot-cms-users/-/LL0xqnYkEdMJ.
To post to this group, send email to reddot-c...@googlegroups.com.
To unsubscribe from this group, send email to reddot-cms-use...@googlegroups.com.

Rob

unread,
Aug 8, 2012, 3:45:23 PM8/8/12
to reddot-c...@googlegroups.com, RedDot CMS Users
Thanks for all the discussion.  A couple options got vetted out since my last posting here.
 
It seems like we have the best solution uncovered for our needs.   JQuery/JavaScript would work the best.  Other solutions would be tricky for a future developer to recognize it was in place and modify it as need. 
I will update our test site to test it.  Assuming Facebook developer documentation is correct, it will take at least 24 hours for Facebook to crawl and cache the page to demonstrate the JavaScript solution works.  Hope Facebook crawler executes JavaScript.  Like I said in the beginning of this issue, this is for the Facebook Like button to know which image to show in the Liker's News Feed.
 
Thanks everyone!
 
Rob

Tony Chung

unread,
Aug 9, 2012, 1:30:12 AM8/9/12
to reddot-c...@googlegroups.com
It doesn't look like FB crawler parses JavaScript.

--
You received this message because you are subscribed to the Google Groups "RedDot CMS Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/reddot-cms-users/-/XlXAQr_SFBsJ.

Jian Huang

unread,
Aug 9, 2012, 11:49:09 AM8/9/12
to reddot-c...@googlegroups.com
Hi everyone,

I realized that we all concentrated on the programming approach without thinking outside the box.

We know that we can get file name of a img/med file via info placeholder.

We setup publication packages, which included mapping of asset manger/file folder to folders on the published web server.  Also, these mapping rarely change for image/asset folders.

Why can't we just do this

<reddot:cms>
<if>
    <query valuea="Context:CurrentRenderMode" operator="!=" valueb="Int:2">
        <htmltext>
            <!-- no publish mode, use javascript to get path -->
        </htmltext>
    </query>
    <query type="else">
        <htmltext>
            <img src="/IKnowItGoesHere/<%inf_facebook_photo_file_name%>" alt="">
        </htmltext>
    </query>
</if>
</reddot:cms>

Rob

unread,
Aug 15, 2012, 2:43:41 PM8/15/12
to reddot-c...@googlegroups.com, RedDot CMS Users
As Richard pointed out, JavaScript won't work since Facebook won't execute it when it crawls the page.
 
We will try the solution Jian suggested.
 
Rob

Joel Kinzel

unread,
Aug 28, 2012, 11:30:15 AM8/28/12
to reddot-c...@googlegroups.com
We face a similar problem right now as well. But the difference is the page that holds our image is not in navigation (it is a "table of contents" type of page so we don't want it in navigation).

My understanding is that if an asset isn't used on the site, it won't get published. Is this limited to those assets that page builder would "touch" as a result of rendering the site for publish? Or are the assets treated differently in that, if they have some usage listed, they would get published? 
Reply all
Reply to author
Forward
0 new messages