Example #1
0
 def search(self):
     return Data(loop="""<?php
         $search = new search(array(
           'searchfield' => 'q',
           'words' => true,
           'in' => 'articles',
           'paginate'    => 10
         ));     
         $results = $search->results();
         $blog = $pages->find('articles');
         $tags = tagcloud($blog);
     ?>""")
Example #2
0
 def feed(self):
     return Data(text="""<?php       
         // get any list of items    
         // in this case we get all visible children of the blog section, 
         // flip them to get them in reverse order and make sure we only get the last 10
         $items = $pages->find('articles')->children()->visible()->flip()->limit(10);
         // this is how you embed the feed snippet with some options    
         snippet('feed', array(
           'link'  => url('articles'),
           'items' => $items,
           'descriptionField'  => 'text', 
           'descriptionLength' => 300
         ));
     ?>""")
Example #3
0
 def articles(self):
     return Data(text="""<?php if(param('tag')) {
         $articles = $pages->find('articles')
             ->children()
             ->visible()
             ->filterBy('tags', param('tag'), ',')
             ->flip()
             ->paginate(10);
         } else {
         $articles = $pages->find('articles')
             ->children()
             ->visible()
             ->flip()
             ->paginate(10);
         } ?>
         """)
Example #4
0
 def articlesPrevUrl(self):
     return Data(url="<?= $articles->pagination()->prevPageURL() ?>")
Example #5
0
 def pageUrl(self):
     return Data(url="<?php echo $page->url() ?>")
Example #6
0
 def ifPageHasNext(self):
     return Data(text="<?php if($page->hasNext()): ?>")
Example #7
0
 def rightArrow(self):
     return Data(text=u"»")
Example #8
0
 def pagePrevUrl(self):
     return Data(url="<?php echo $page->prev()->url() ?>")
Example #9
0
 def searchUrl(self):
     return Data(url="<?php echo html($pages->find('search')->url()) ?>")
Example #10
0
 def tagUrl(self):
     return Data(url="<?php echo $tag->url() ?>")
Example #11
0
 def forEachTag(self):
     return Data(text="<?php foreach($tags as $tag): ?>")
Example #12
0
 def htmlSearchQuery(self):
     return Data(text="<?php echo html($search->query()) ?>")
Example #13
0
 def elseIfSearchQuery(self):
     return Data(text="<?php elseif($search->query()): ?>")
Example #14
0
 def readMoreLabel(self):
     return Data(text=u"Read more.")
Example #15
0
 def resultText(self, count):
     return Data(text="<?php echo excerpt($result->text(), %d) ?>" % count)
Example #16
0
 def siteTitle(self):
     return Data(text="<?php echo h($site->title()) ?>")
Example #17
0
 def pageTitle(self):
     return Data(text="<?php echo h($page->title()) ?>")
Example #18
0
 def tagName(self):
     return Data(text="<?php echo $tag->name() ?>")
Example #19
0
 def previousLabel(self):
     return Data(text=self.leftArrow() + u' Previous')
Example #20
0
 def getPages(self, count): 
     return Data(items=[])
Example #21
0
 def nextLabel(self):
     return Data(text=u'Next ' + self.rightArrow())
Example #22
0
 def getSnippet(self, s1, s2=None):
     if s2 is None:
         return Data(text="<?php snippet('%s') ?>\n" % s1)
     return Data(text="<?php snippet('%s', %s) ?>\n" % (s1, s2))
Example #23
0
 def leftArrow(self):
     return Data(text=u"«")
Example #24
0
 def getPageTitle(self, **kwargs):
     return Data(text='<?php echo h($site->title()) ?> : %s' % (kwargs.get('title', 'Untitled')))  # To be redefined by inheriting adapter class.
Example #25
0
 def pageNextUrl(self):
     return Data(text="<?php echo $page->next()->url() ?>")
Example #26
0
 def thisUrl(self):
     return Data(url="<?php echo thisURL() ?>")
Example #27
0
 def pagePublished(self):
     return Data(text="<?php echo html($page->published()) ?>")
Example #28
0
 def chapters(self):  
     return Data(loop='Chapters')
Example #29
0
 def ifArticlesHasNext(self):
     return Data(text="<?php if($articles->pagination()->hasNextPage()): ?>")
Example #30
0
 def featuredArticles(self):
     return Data(loop='Featured Kirby articles')