Open cnb opened 11 years ago
add custom setting to switch to custom post layout (overriding built-in default):
create php functions to display/return the current post data (à la WordPress' The Loop)
optional: use some placeholders ({{title}}, etc.)?
morvy's suggestion: http://get-simple.info/forums/showthread.php?tid=7332&pid=53811#pid53811
- give option to override functions responsible for printing output (like in wordpress, if custom function exists, skip default function) or
- give option to define custom function in settings, something like "main function nm_list_post_custom"
if custom functions were placed in the theme's functions.php
file, it would work with GS <= 3.3, but not for the future 3.4, because the file will since then be included after the index-pretemplate hook (GS feature 539).
So I think we'll need a new theme file to be included by NM (e.g. nm.inc.php
, news_manager.inc.php
, nm-functions.inc.php
, or perhaps news_manager/functions.php
...)
38f64b7a689a123359ceee6ac23c7b7c10594b48
templateShowPost
componentShowPost
Their output depends on normal and custom settings (e.g.titleLink
, classPostTitleLink
, DATE_FORMAT
, more
, etc.)
nm_render_title()
nm_render_date()
nm_render_content()
nm_render_tags()
nm_render_image()
nm_render_author()
nm_goback_link()
They return true
or false
and can be used, for example, in if (...) { ... }
sentences.
nm_has_tags()
nm_must_render_image()
nm_must_render_author()
nm_has_goback_link()
They just output field values, independently of settings
nm_put_url()
nm_put_title()
nm_put_content()
nm_put_excerpt($length=150, $ellipsis='...', $break=false)
nm_put_date($format='Y-m-d')
nm_put_image($width=0, $height=0, $crop=false, $default='')
They return raw field values that can be assigned to variables or whatever. If echoed, should be done be done with htmlspecialchars
nm_return_url()
nm_return_title()
nm_return_content()
nm_return_excerpt($length=150, $ellipsis='...', $break=false)
nm_return_date($format='Y-m-d')
nm_return_tags()
nm_return_image($width=0, $height=0, $crop=false, $default='')
fd47045172d875ea0eedd20963b4ad484a781002
nm_r('TEXT')
- like i18n_r('news_manager/TEXT')
, but returns {TEXT}
if translation not availablenm_e('TEXT')
- same but echo instead of return
full post, short post, recent post, etc.