Gaurav,

following through the logic:

#set($pinnedEntries = $site.getPinnedWeblogEntries(5))
 #foreach($pinnedEntry in $pinnedEntries)


$site == org.apache.roller.weblogger.ui.rendering.model.SiteModel

So if you check getPinnedWeblogEntries(..) of SiteModel:

/**
     * Get pinned entries.
     * @param sinceDays Only consider weblogs updated in the last sinceDays
     * @param length    Max number of results to return
     */
    public List getPinnedWeblogEntries(int length) {
        List results = new ArrayList();
        try {
            Weblogger roller = WebloggerFactory.getWeblogger();
            WeblogEntryManager wmgr = roller.getWeblogEntryManager();
            List weblogs = wmgr.getWeblogEntriesPinnedToMain(length);
            for (Iterator it = weblogs.iterator(); it.hasNext();) {
                WeblogEntry entry = (WeblogEntry) it.next();
                results.add(WeblogEntryWrapper.wrap(entry, urlStrategy));
            }
        } catch (Exception e) {
            log.error("ERROR: fetching pinned weblog entries", e);
        }
        return results;
    }

It retrieves a list worf weblogs:

List weblogs = wmgr.getWeblogEntriesPinnedToMain(length);

from method getWeblogEntriesPinnedToMain of

org.apache.roller.weblogger.business.jpa.JPAWeblogEntryManagerImpl


public List getWeblogEntriesPinnedToMain(Integer max)
    throws WebloggerException {
        Query query = strategy.getNamedQuery(
                "WeblogEntry.getByPinnedToMain&statusOrderByPubTimeDesc");
        query.setParameter(1, Boolean.TRUE);
        query.setParameter(2, WeblogEntry.PUBLISHED);
        if (max != null) {
            query.setMaxResults(max);
        }
        return query.getResultList();
    }

it will execute a named query:

WeblogEntry.getByPinnedToMain&statusOrderByPubTimeDesc

from:
app/src/main/resources/org/apache/roller/weblogger/pojos/WeblogEntry.orm.xml

<named-query
name="WeblogEntry.getByPinnedToMain&amp;statusOrderByPubTimeDesc">
            <query>SELECT w FROM WeblogEntry w WHERE w.pinnedToMain = ?1
AND w.status = ?2 ORDER BY w.pubTime DESC</query>
</named-query>

Is this OK?

Cheers Greg




On 17 December 2013 13:33, Gaurav <[email protected]> wrote:

> Hello,
>
> I am still not able to populate the results in frontpage theme. The
> condition I see in this theme is different from other is this
> [#foreach($pinnedEntry in $pinnedEntries)]. Can any one explain me what is
> pinnedEntry here ? As in that theme we still use #foreach($entry in
> $entries) for the search results, that is why I was saying search results
> are coming fine.
>
> Thanks
> Gaurav
>
> On Tuesday 17 December 2013 03:29 PM, Greg Huber wrote:
>
>> It should work ok, the front page theme is for the initial front page
>> weblog, right?
>>
>> Cheers Greg.
>>
>>
>> On 17 December 2013 09:38, Gaurav <[email protected]> wrote:
>>
>>  Hello,
>>>
>>> I tried using the frontpage theme of roller, but it seems like this theme
>>> has some issue as It did not show up any data (no blogs, hottags, hot
>>> blogs
>>> etc.)
>>> But when I tried searching in the search of that theme, then it shows the
>>> blogs. I am looking into this, just want to know Is anyone out there for
>>> whom this theme is working perfectly fine ?
>>>
>>> --
>>> Regards,
>>> *Gaurav Saini*
>>> /Developer, Digital Marketing and Pursuing B.Tech/
>>> /Email: [email protected]/
>>>
>>>
>

Reply via email to