Beispiel #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);
     ?>""")
Beispiel #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
         ));
     ?>""")
Beispiel #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);
         } ?>
         """)
Beispiel #4
0
 def articlesPrevUrl(self):
     return Data(url="<?= $articles->pagination()->prevPageURL() ?>")
Beispiel #5
0
 def pageUrl(self):
     return Data(url="<?php echo $page->url() ?>")
Beispiel #6
0
 def ifPageHasNext(self):
     return Data(text="<?php if($page->hasNext()): ?>")
Beispiel #7
0
 def rightArrow(self):
     return Data(text=u"»")
Beispiel #8
0
 def pagePrevUrl(self):
     return Data(url="<?php echo $page->prev()->url() ?>")
Beispiel #9
0
 def searchUrl(self):
     return Data(url="<?php echo html($pages->find('search')->url()) ?>")
Beispiel #10
0
 def tagUrl(self):
     return Data(url="<?php echo $tag->url() ?>")
Beispiel #11
0
 def forEachTag(self):
     return Data(text="<?php foreach($tags as $tag): ?>")
Beispiel #12
0
 def htmlSearchQuery(self):
     return Data(text="<?php echo html($search->query()) ?>")
Beispiel #13
0
 def elseIfSearchQuery(self):
     return Data(text="<?php elseif($search->query()): ?>")
Beispiel #14
0
 def readMoreLabel(self):
     return Data(text=u"Read more.")
Beispiel #15
0
 def resultText(self, count):
     return Data(text="<?php echo excerpt($result->text(), %d) ?>" % count)
Beispiel #16
0
 def siteTitle(self):
     return Data(text="<?php echo h($site->title()) ?>")
Beispiel #17
0
 def pageTitle(self):
     return Data(text="<?php echo h($page->title()) ?>")
Beispiel #18
0
 def tagName(self):
     return Data(text="<?php echo $tag->name() ?>")
Beispiel #19
0
 def previousLabel(self):
     return Data(text=self.leftArrow() + u' Previous')
Beispiel #20
0
 def getPages(self, count): 
     return Data(items=[])
Beispiel #21
0
 def nextLabel(self):
     return Data(text=u'Next ' + self.rightArrow())
Beispiel #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))
Beispiel #23
0
 def leftArrow(self):
     return Data(text=u"«")
Beispiel #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.
Beispiel #25
0
 def pageNextUrl(self):
     return Data(text="<?php echo $page->next()->url() ?>")
Beispiel #26
0
 def thisUrl(self):
     return Data(url="<?php echo thisURL() ?>")
Beispiel #27
0
 def pagePublished(self):
     return Data(text="<?php echo html($page->published()) ?>")
Beispiel #28
0
 def chapters(self):  
     return Data(loop='Chapters')
Beispiel #29
0
 def ifArticlesHasNext(self):
     return Data(text="<?php if($articles->pagination()->hasNextPage()): ?>")
Beispiel #30
0
 def featuredArticles(self):
     return Data(loop='Featured Kirby articles')