phpDocumentor pond
[ class tree: pond ] [ index: pond ] [ all elements ]

Procedural File: _template.funcs.php

Source Location: /qp_inc/_core/_template.funcs.php

Page Details

This file implements misc functions that handle output of the HTML page.

This file is part of Quam Plures - http://quamplures.net/ See also https://launchpad.net/quam-plures.

Author:  blueyed: Daniel HAHLER.
Author:  fplanque: Francois PLANQUE.
Copyright:  

(c)2003-2009 by Francois PLANQUE - http://fplanque.net/ Parts of this file are copyright (c)2004-2006 by Daniel HAHLER - http://thequod.de/contact.

Copyright:  (c) 2009 - 2011 by the Quam Plures developers - http://quamplures.net/
Filesource:  Source Code for this file
Functions
addup_percentage  [line 951]

void addup_percentage( $hit_count, $hit_total, [ $decimals = 1], [ $dec_point = '.']  )
Parameters:
   $hit_count: 
   $hit_total: 
   $decimals: 
   $dec_point: 


[ Top ]
add_css_headline  [line 698]

void add_css_headline( string $headline  )

Add a CSS headline.

This is an extra function, to provide consistent wrapping and allow to bundle it (i.e. create a bundle with all required JS files and these inline code snippets, in the correct order).

Parameters:
string   $headline:  CSS


[ Top ]
add_headline  [line 670]

void add_headline( string $headline  )

Add a headline, which then gets output in the HTML HEAD section.

If you want to include CSS or JavaScript files, please use require_css() and require_js() instead. This avoids duplicates and allows caching/concatenating those files later (not implemented yet)

Parameters:
string   $headline: 


[ Top ]
add_js_for_toolbar  [line 712]

void add_js_for_toolbar( )

T-Tag: Registers all the javascripts needed by the toolbar menu


Information Tags:
Todo:  (legacy): fp> include basic.css ? -- rename to add_headlines_for* -- potential problem with inclusion order of CSS files!! dh> would be nice to have the batch of CSS in a separate file. basic.css would get included first always, then e.g. this toolbar.css.

[ Top ]
add_js_headline  [line 684]

void add_js_headline( string $headline  )

Add a Javascript headline.

This is an extra function, to provide consistent wrapping and allow to bundle it (i.e. create a bundle with all required JS files and these inline code snippets, in the correct order).

Parameters:
string   $headline:  Javascript


[ Top ]
add_js_translation  [line 652]

void add_js_translation( string $string, string $translation  )

Memorize that a specific translation will be required by the current page.

All requested translations will be included in the page body only once (when footerlines is called)

Parameters:
string   $string:  string, untranslated string
string   $translation:  translation, translated string


[ Top ]
app_version  [line 791]

void app_version( )

Template tag.



[ Top ]
base_tag  [line 399]

string base_tag( string $url, [ $target = NULL]  )

Returns a "<base />" tag and remembers that we've used it (regenerate_url() needs this).

Parameters:
string   $url:  URL to use (this gets used as base URL for all relative links on the HTML page)
   $target: 

API Tags:
Usedby:  template_base_tag()


[ Top ]
blog_home_link  [line 462]

void blog_home_link( [ $before = ''], [ $after = ''], [ $blog_text = 'Blog'], [ $home_text = 'Home']  )

Output a link to current blog.

We need this function because if no Blog is currently active (some admin pages or site pages) then we'll go to the general home.

Parameters:
   $before: 
   $after: 
   $blog_text: 
   $home_text: 


[ Top ]
bullet  [line 803]

void bullet( boolean $bool  )

Displays an empty or a full bullet based on boolean

Parameters:
boolean   $bool:  true for full bullet, false for empty bullet


[ Top ]
display_if_empty  [line 902]

void display_if_empty( [ $params = array()]  )

T-Tag: Display a message if MainList is empty

Parameters:
   $params: 

API Tags:
Uses:  Results::display_if_empty()


[ Top ]
header_content_type  [line 39]

void header_content_type( [ $type = 'text/html'], [ $charset = '#']  )

T-Tag: Outputs content-type header, sets charset

Parameters:
   $type: 
   $charset: 


[ Top ]
header_nocache  [line 187]

void header_nocache( )

Sends HTTP headers to avoid caching of the page.



[ Top ]
header_redirect  [line 76]

void header_redirect( [string $redirect_to = NULL], [boolean|integer $permanent = false]  )

Sends HTTP header to redirect to the previous location (which can be given as function parameter, GET parameter (redirect_to), is taken from Hit::$referer or $app_baseurl).

$Debuglog and $Messages get stored in $Session, so they are available after the redirect.

NOTE: This function exit() the php script execution.

Parameters:
string   $redirect_to:  Destination URL to redirect to
boolean|integer   $permanent:  is this a permanent redirect? if true, send a 301; otherwise a 303 OR response code 301,302,303

Information Tags:
Todo:  fp> do NOT allow $redirect_to = NULL. This leads to spaghetti code and unpredictable behavior.

[ Top ]
include_footerlines  [line 763]

void include_footerlines( )

Outputs the collected translation lines before </body>

yabs > Should this be expanded to similar functionality to headlines?


API Tags:
See:  add_js_translation()


[ Top ]
include_headlines  [line 744]

string include_headlines( )

T-Tag: Outputs the collected HTML HEAD lines.


API Tags:
See:  add_headline()


[ Top ]
item_prevnext_links  [line 817]

void item_prevnext_links( [ $params = array()]  )

T-Tag: Display links to previous and next posts in single post mode

Parameters:
   $params: 

API Tags:
Uses:  ItemList2::prevnext_item_links()


[ Top ]
mainlist_get_item  [line 876]

void &mainlist_get_item( )

T-Tag: Return an Item or NULL


API Tags:
Uses:  ItemListLight::get_item()


[ Top ]
mainlist_page_links  [line 860]

void mainlist_page_links( [ $params = array()]  )

T-Tag: Display links to previous and next posts in multi-post (or list) mode

Parameters:
   $params: 

API Tags:
Uses:  ItemListLight::page_links()


[ Top ]
messages  [line 842]

void messages( [ $params = array()]  )

T-Tag: Display messages from actions if there are any

  1.  $params array_mergearray(
  2.       'block_start' => '<div class="action_messages">',
  3.       'block_end'   => '</div>',
  4.  )$params );

Parameters:
   $params: 

API Tags:
Uses:  Log::display()
Uses:  Log::disp()

Information Tags:
Todo:  Tblue: Default values taken from Log::disp() ... this seems redundant

[ Top ]
meta_generator_tag  [line 448]

void meta_generator_tag( )

T-Tag: Outputs a <meta name="generator"> tag which contains information about this application.



[ Top ]
percentage  [line 946]

void percentage( $hit_count, $hit_total, [ $decimals = 1], [ $dec_point = '.']  )

Return a formatted percentage (should probably go to _misc.funcs)

Parameters:
   $hit_count: 
   $hit_total: 
   $decimals: 
   $dec_point: 


[ Top ]
request_title  [line 240]

void request_title( [ $params = array()]  )

T-Tag: Display a global title matching filter params

Outputs the title of the category when you load the page with

  1. ?cat=

  1.  $params array_mergearray(
  2.    'auto_pilot'          => 'none',
  3.    'title_before'        => '',
  4.    'title_after'         => '',
  5.    'title_none'          => '',
  6.    'title_single_disp'   => true,
  7.    'title_single_before' => '#'// see below
  8.    'title_single_after'  => '#'// see below
  9.    'title_page_disp'     => true,
  10.    'title_page_before'   => '#'// see below
  11.    'title_page_after'    => '#'// see below
  12.    'glue'                => ' - ',
  13.    'format'              => 'htmlbody',
  14.    'arcdir_text'         => T_('Archive Directory'),
  15.    'catdir_text'         => T_('Category Directory'),
  16.    'comments_text'       => T_('Latest Comments'),
  17.    'credits_text'        => T_('Software Credits'),
  18.    'feedback-popup_text' => T_('Feedback'),
  19.    'mediaidx_text'       => T_('Photo Index'),
  20.    'msgform_text'        => T_('Send an Email Message'),
  21.    'profile_text'        => T_('User Profile'),
  22.    'subs_text'           => T_('Subscriptions'),
  23.    'user_text'           => T_('User'),
  24.  )$params );

IF $disp is 'single' or 'page'
AND 'title_single||page_before||after' is not '#'
THEN 'before||after' will be the value of 'title_single||page_before||after'
ELSE 'before||after' will be the value of 'title_before||after'

'auto_pilot' => 'seo_title' uses the SEO title autopilot. (default: "none")

Parameters:
   $params: 

Information Tags:
Todo:  (legacy): single month: Respect locales datefmt
Todo:  (legacy): single post: posts do no get proper checking (wether they are in the requested blog or wether their permissions match user rights, thus the title sometimes gets displayed even when it should not. We need to pre-query the ItemList instead!!
Todo:  (legacy): make it complete with all possible params!

[ Top ]
require_css  [line 557]

void require_css( string $css_file, [boolean|string $relative_to_base = false], [string $title = NULL], [string $media = NULL]  )

Memorize that a specific css that file will be required by the current page.

All requested files will be included in the page head only once (when headlines is called)

Accepts absolute urls, filenames relative to the qp_rsc/css directory. Set $relative_to_base to TRUE to prevent this function from adding on the rsc_path

Parameters:
string   $css_file:  alias, url or filename (relative to qp_rsc/css) for CSS file
boolean|string   $relative_to_base:  Is the file's path relative to the base path/url? Use true to not add any prefix ("$rsc_url/css/").
string   $title:  title. The title for the link tag
string   $media:  media. ie, 'print'

Information Tags:
Todo:  dh>merge with require_js()

[ Top ]
require_js  [line 490]

void require_js( string $js_file, [boolean $relative_to_base = false]  )

Memorize that a specific javascript file will be required by the current page.

All requested files will be included in the page head only once (when headlines is called)

Accepts absolute urls, filenames relative to the qp_rsc/js directory and certain aliases, like 'jquery' and 'jquery_debug' If 'jquery' is used and $debug is set to true, the 'jquery_debug' is automatically swapped in. Any javascript added to the page is also added to the $required_js array, which is then checked to prevent adding the same code twice

Parameters:
string   $js_file:  alias, url or filename (relative to qp_rsc/js) for javascript file
boolean   $relative_to_base:  Is the file's path relative to the base path/url? Use false if file is in $rsc_url/js/

Information Tags:
Todo:  dh>merge with require_css()

[ Top ]
require_js_helper  [line 602]

void require_js_helper( [string $helper = '']  )

Memorize that a specific js helper will be required by the current page.

All requested helpers will be included in the page head only once (when headlines is called) All requested helpers will add their required translation strings and any other settings

Parameters:
string   $helper:  helper, name of the required helper


[ Top ]
robots_tag  [line 416]

void robots_tag( )

T-Tag: Outputs the "meta name robots" tag, if needed



[ Top ]
star_rating  [line 918]

void star_rating( $stars, [ $class = 'middle']  )

Display rating as 5 stars

Parameters:
   $stars: 
   $class: 


[ Top ]