Fatal error: Call to a member function getCollectionID()

Permalink
Hello,

I wanted to find out the page CID, so I add this code to my themes elements/header.php file:

<?php $page->getCollectionID();?>

But I get the error:
Fatal error: Call to a member function getCollectionID() on a non-object in /srv/www/performance-equestrian.com/default/htdocs/themes/perfeq-v3.1/elements/header.php on line 110


Am i going about this right?




# concrete5 Version
5.6.3.1

# concrete5 Packages
301 Redirects (2.2.1), Country State Manager (1.0.1), eCommerce (2.8.11), eCommerce - Local Pickup (1.1.1), eCommerce - Special Instructions (0.9.8.3), eCommerce Product Options With Images (0.9.3), Formidable (2.0.4), PHP block by ND (1.0), Product Multi Inventory (2.0.0), Sidebar Cart (0.9), Zone Based Shipping (1.9.0.2).

# concrete5 Overrides
blocks/autonav, helpers/lists, js/jquery-1.11.0.min.js, js/jquery.simpleSlider.js, js/html5shim.js, js/shoppie.scripts.js, js/jquery-1.11.0.js, js/juicy, js/jquery.easing.min.js, js/jquery-1.11.0.min.map, js/modernizr.js, js/css3-mediaqueries.js, js/fancybox, js/noUiSlider, languages/es_ES, languages/vi_VN, languages/ja_JP, languages/de_DE, languages/he_IL, languages/cs_CZ, languages/zh_TW, languages/el_GR, languages/ar, languages/fi_FI, languages/nl_NL, languages/nb_NO, languages/zh_CN, languages/tr_TR, languages/es_MX, languages/es_AR, languages/da_DK, languages/sk_SK, languages/fa_IR, languages/fr_FR, languages/ro_RO, languages/sv_SE, languages/it_IT, languages/ru_RU, languages/sl_SI, languages/es_PE, languages/pt_PT, themes/perfeq-v3.1

# concrete5 Cache Settings
Block Cache - Off
Overrides Cache - Off
Full Page Caching - Off

# Server Software
nginx/1.3.3

# Server API
fpm-fcgi

# PHP Version
5.3.15

# PHP Extensions
bcmath, bz2, calendar, cgi-fcgi, Core, ctype, curl, date, dba, dom, ereg, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, imap, intl, json, libxml, mbstring, mcrypt, mysql, mysqli, odbc, openssl, pcre, PDO, pdo_mysql, PDO_ODBC, pdo_sqlite, Phar, pspell, Reflection, session, shmop, SimpleXML, sockets, SPL, standard, tokenizer, wddx, xml, xmlreader, xmlwriter, xsl, zip, zlib.

# PHP Settings
max_execution_time - 600
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 60
max_input_vars - 1000
memory_limit - 128M
post_max_size - 2048M
safe_mode - Off
safe_mode_exec_dir - <i>no value</i>
safe_mode_gid - Off
safe_mode_include_dir - <i>no value</i>
sql.safe_mode - Off
upload_max_filesize - 2048M
mysql.max_links - Unlimited
mysql.max_persistent - Unlimited
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
odbc.max_links - Unlimited
odbc.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
session.cache_limiter - nocache
session.gc_maxlifetime - 7200
safe_mode_allowed_env_vars - PHP_
safe_mode_protected_env_vars - LD_LIBRARY_PATH

cytringan
 
enlil replied on at Permalink Best Answer Reply
enlil
It should be something like:

$page = Page::getCurrentPage();
$pageid = $page->getCollectionID();
echo $pageid;
cytringan replied on at Permalink Reply
cytringan
Thankyou! it works