Forums de discussion

how show and use content "web content" in portlet

hadi mohammadi, modifié il y a 10 années.

how show and use content "web content" in portlet

Junior Member Publications: 48 Date d'inscription: 03/06/13 Publications récentes
i want show content "web content" in portlet.
i want use my portlet instead of asset publisher for customize it.
i search and i think should use queryBuilder.
but i don't know how use queryBuilder for fetch content "web content".
please help me.
thumbnail
Jose Jiménez, modifié il y a 10 années.

RE: how show and use content "web content" in portlet

Regular Member Publications: 176 Date d'inscription: 23/08/12 Publications récentes
Hi Hadi,

You can get it with the API:

For searching or getting web-content: JournalArticleLocalService.java

For displaying it: JournalContentUtil.java

However what you can do to avoid to develop a new portlet is to build a customized view of Asset Publisher with ADT Framework

I hope you find this info helpful.

Kind regards,
Jose
hadi mohammadi, modifié il y a 10 années.

RE: how show and use content "web content" in portlet

Junior Member Publications: 48 Date d'inscription: 03/06/13 Publications récentes
Thanks Jose.
i want show web-contents with structure "News"
please put code for show web-contents with structure"News"
Thanks
thumbnail
Jose Jiménez, modifié il y a 10 années.

RE: how show and use content "web content" in portlet

Regular Member Publications: 176 Date d'inscription: 23/08/12 Publications récentes
You can use the methods com.liferay.portlet.journal.service.JournalArticleLocalServiceUtil.getStructureArticles(long, String) and com.liferay.portlet.journalcontent.util.JournalContentUtil.getContent(long, String, String, String, String, ThemeDisplay)

Regards,
Jose
hadi mohammadi, modifié il y a 10 années.

RE: how show and use content "web content" in portlet

Junior Member Publications: 48 Date d'inscription: 03/06/13 Publications récentes
Thanks a lot Jose.
I'm using portal 6.1
How can I use ADT framework?
where can I download it?
please give me a download link.
thumbnail
Jose Jiménez, modifié il y a 10 années.

RE: how show and use content "web content" in portlet

Regular Member Publications: 176 Date d'inscription: 23/08/12 Publications récentes
Hi again,

ADT is part of the new features included in 6.2.x versions and is not available for 6.1.x

Regards
hadi mohammadi, modifié il y a 10 années.

RE: how show and use content "web content" in portlet

Junior Member Publications: 48 Date d'inscription: 03/06/13 Publications récentes
i use from below code

public class Controller3 extends MVCPortlet {
	public void doView(RenderRequest renderRequest, RenderResponse renderResponse)throws IOException, PortletException 
    {
		try {					
			try {
				long companyId = PortalUtil.getDefaultCompanyId();
				long userId = UserLocalServiceUtil.getDefaultUserId(companyId);
				long groupId = GroupLocalServiceUtil.getGroup(companyId, "Guest").getGroupId();				
				String languageId = LanguageUtil.getLanguageId(renderRequest);
				ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);

				List<journalarticle> a1 = JournalArticleLocalServiceUtil.getStructureArticles(groupId, "21602");		        
				for(JournalArticle journalArticle : a1)
				{
					String jjj = JournalContentUtil.getContent(journalArticle.getGroupId(), journalArticle.getArticleId() , "view", languageId, themeDisplay);   
					System.out.println(jjj);
					System.out.println("***************");					
				}
			} catch (PortalException e) {
				e.printStackTrace();
			}			
			
		} catch (SystemException e1) {
			e1.printStackTrace();
		}        
    }
}
</journalarticle>

but i show below content

<style>
.toBox {
border:1px #CCCCCC solid;
border-radius:5px; 
padding-right:10px;
margin-left:20px;
margin-top:10px;
padding-bottom:10px;
}
.setPurple{
color:#941063;
}
</style>
<div style="direction:rtl;text-align:right;padding-right:20px;">
    <div class="pagecontent" id="pagecontent">
        <div id="newsHeader" class="toBox">
          <div id="mainTitle">
                <p>
                    <strong class="setPurple" style="font-size:20px;">
                        tesssst
                    </strong>
                </p>
            </div>
            <div id="Thumbnail">
                <img style="width:10%;height:5%;" src="">
            </div>
            <div id="specialHeaders">
                <b class="setPurple">: سرتیتر</b>
                <br>
                                    /
                            </div>
        </div>
        <div id="outline" class="toBox">
                <b class="setPurple">
                    خلاصه خبر
                </b>
                <br>
            
        </div>

        <div id="newBody" class="toBox">
            
        </div>
        <div id="authors">
        <b class="setPurple">نویسندگان : </b>
        <ul>
            			    <li>
	               		
                </li>
		            </ul>
	</div>
        <div id="sources">
        <b class="setPurple">منابع :</b>
		<ul>
            			    <li>
                    
			    </li>
            		</ul>
	</div>
    </div>
</div>
***************
<style>
.toBox {
border:1px #CCCCCC solid;
border-radius:5px; 
padding-right:10px;
margin-left:20px;
margin-top:10px;
padding-bottom:10px;
}
.setPurple{
color:#941063;
}
</style>
<div style="direction:rtl;text-align:right;padding-right:20px;">
    <div class="pagecontent" id="pagecontent">
        <div id="newsHeader" class="toBox">
          <div id="mainTitle">
                <p>
                    <strong class="setPurple" style="font-size:20px;">
                        tesssst
                    </strong>
                </p>
            </div>
            <div id="Thumbnail">
                <img style="width:10%;height:5%;" src="">
            </div>
            <div id="specialHeaders">
                <b class="setPurple">: سرتیتر</b>
                <br>
                                    /
                            </div>
        </div>
        <div id="outline" class="toBox">
                <b class="setPurple">
                    خلاصه خبر
                </b>
                <br>
            
        </div>

        <div id="newBody" class="toBox">
            
        </div>
        <div id="authors">
        <b class="setPurple">نویسندگان : </b>
        <ul>
            			    <li>
	               		
                </li>
		            </ul>
	</div>
        <div id="sources">
        <b class="setPurple">منابع :</b>
		<ul>
            			    <li>
                    
			    </li>
            		</ul>
	</div>
    </div>
</div>


i want only all cotent "web-content" and i don't want see xml code.
please help me.
thumbnail
Tanweer Ahmed ., modifié il y a 1 année.

RE: how show and use content "web content" in portlet

Expert Publications: 322 Date d'inscription: 11/03/10 Publications récentes
Hi Hadi,

Use the below code to get the String content instead of xml code.

String jjj = JournalContentUtil.getContent(journalArticle.getGroupId(), journalArticle.getArticleId() , "view", languageId, themeDisplay);

Document document = SAXReaderUtil.read(jjj);
return document.selectSingleNode("/root/dynamic-element[@name='" + elementName + "']/dynamic-content").getText();


Hope this helps.

Regards,
Tanweer.