on 02-16-2006 9:41 AM
Hello,
I created an own BSP Extension element "myLink" which should be a composite element containing HTMLB:LINK element.
The myLink-DO_AT_BEGINNING looks like follows:
-
-
DATA: orgLink TYPE REF TO CL_HTMLB_LINK.
orgLink = CL_HTMLB_LINK=>FACTORY( id = id
reference = reference
text = text ).
WHILE m_page_context->element_process( element = orgLink )
EQ CO_ELEMENT_CONTINUE.
ENDWHILE.
rc = CO_ELEMENT_CONTINUE.
-
-
This works fine for - Tag (coming from DO_AT_END of HTMLB:LINK) is inserted before the body of my element.
It is possible to add the text "LinkText" as a literal in the WHILE - loop. But: I don´t find a way to do this dynamically! The body of a myExtension:myLink can contain text, images, other BSP elements. How can I access this during runtime so that I can supply the BODY-parameter of method "element_process"? How to do this? Or isn´t this the solution for this problem?
Maybe I´m to silly to see obvious things. I read a lot of articles about composite BSP elements - but I didn´t find an example handling dynamic or unknown element-bodies.
Thank you for any help,
best regards,
Stefan
Hi Stefan,
look at the implementation of
CL_HTMLB_LINK->IF_BSP_ELEMENT~DO_AT_END
so you have to implement your own do_at_end.
Don't forget to check at bsp-element attributes that the element-content attribute is checked at bsp-elements & html.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Sebastian,
wow, this was really a fast answer. I checked your proposal, but I´m no not sure if this solves my problem.
After performing
-
-
orgLink = CL_HTMLB_LINK=>FACTORY( id = id
reference = reference
text = text ).
WHILE m_page_context->element_process( element = orgLink )
EQ CO_ELEMENT_CONTINUE.
ENDWHILE.
-
-
the CL_HTMLB_LINK~DO_AT_END was performed and has already inserted the "</a>" tag. So it will not help if I change the DO_AT_END method of my extension.
I want to use the m_page_context->element_process method to process the "wrapped" HTMLB-element (HTMLB:LINK in my example) and do not want to copy all methods and attribues to an own BSP extension. I think for this reason the optional "BODY" - paramenter of m_page_context->element_process method is for. But I´ve no idea how to supply it.
Best regards,
Stefan Obermeier
Hi Stefen,
If you want te text to be inserted before the closing tag then you need to add some code to the while loop in your code.
Check this:
orgLink = CL_HTMLB_LINK=>FACTORY( id = id
reference = reference
text = text ).
WHILE m_page_context->element_process( element = orgLink )
EQ CO_ELEMENT_CONTINUE.
DATA: out TYPE REF TO IF_BSP_WRITER.
out = m_page_context->get_out( ).
out->print_string( 'Hello' ).
ENDWHILE.
-
This will add the text "Hello" between the ending and closing tags.
Hope it'll help.
Cheers
Ankur
Hi Stefan,
I understand what you want to achieve - maybe you have to play around with the "delegated" attributes/methods to really achieve what you want using HMTLB:LINK from within your element this way.
Here is what I did for a similar problem: I created my own tooltip-on-mouseover extension, which can be wrapped around any kind of other elements that are placed in the tooltip element body.
I also have a special attribute in this element, "contentAsLink". If this attribute is set, I render the opening href HTML tag (<a>) in method DO_AT_BEGINNING, and the closing tag (</a>) in DO_AT_END. Not the best way if you really want to stick with HTMLB everywhere, but it's nice and easy.
Here is the precise opening tag I use:
<a class="urLnkFunction" href="javascript:void(0);">
Hope this helps you to find a solution for your needs.
Cheers,
Max
Hello Stefan,
the problem is the WHILE Statement in your extension. What you have to do is:
1. declare orgLink as Instance Private (or Protected) Attribute at your (extension) class
2. instead of
WHILE m_page_context->element_process( element = orgLink )
EQ CO_ELEMENT_CONTINUE. ENDWHILE.
please use
m_page_context->element_process( element = orgLink ).
in DO_AT_BEGINNING and a second
m_page_context->element_process( element = orgLink ).
in DO_AT_END
So the opening tag will be rendered in DO_AT_BEGINNING and the closing tag in DO_AT_END.
Hth, Bernhard
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.