Add programmatically?

Permalink Browser Info Environment
How would I add this template programmatically? Here's what I have:

$sb = BlockType::getByHandle('search');
$sb->controller->buttonText = 'Search';
$sb->render('templates/expanding_search');


This doesn't work. I suspect it's because the path is wrong for the template, but I don't know what path to use.

Type: Pre-Sale
Status: In Progress
View Replies:
ronyDdeveloper replied on at Permalink Reply
ronyDdeveloper

concrete5 Environment Information

# concrete5 Version
Core Version - 5.7.5.3
Version Installed - 5.7.5.3
Database Version - 20150731000000

# concrete5 Packages
Cloneamental (0.9.1), Ronyd Expanded Search Bar (2.0).

# concrete5 Overrides
languages/da_DK/LC_MESSAGES/messages.mo, languages/da_DK/LC_MESSAGES, languages/da_DK, languages/de_DE/LC_MESSAGES/messages.mo, languages/de_DE/LC_MESSAGES, languages/de_DE, languages/el_GR/LC_MESSAGES/messages.mo, languages/el_GR/LC_MESSAGES, languages/el_GR, languages/es_PY/LC_MESSAGES/messages.mo, languages/es_PY/LC_MESSAGES, languages/es_PY, languages/fi_FI/LC_MESSAGES/messages.mo, languages/fi_FI/LC_MESSAGES, languages/fi_FI, languages/fr_FR/LC_MESSAGES/messages.mo, languages/fr_FR/LC_MESSAGES, languages/fr_FR, languages/it_IT/LC_MESSAGES/messages.mo, languages/it_IT/LC_MESSAGES, languages/it_IT, languages/ja_JP/LC_MESSAGES/messages.mo, languages/ja_JP/LC_MESSAGES, languages/ja_JP, languages/nb_NO/LC_MESSAGES/messages.mo, languages/nb_NO/LC_MESSAGES, languages/nb_NO, languages/nl_NL/LC_MESSAGES/messages.mo, languages/nl_NL/LC_MESSAGES, languages/nl_NL, languages/pl_PL/LC_MESSAGES/messages.mo, languages/pl_PL/LC_MESSAGES, languages/pl_PL, languages/pt_BR/LC_MESSAGES/messages.mo, languages/pt_BR/LC_MESSAGES, languages/pt_BR, languages/ru_RU/LC_MESSAGES/messages.mo, languages/ru_RU/LC_MESSAGES, languages/ru_RU, languages/sv_SE/LC_MESSAGES/messages.mo, languages/sv_SE/LC_MESSAGES, languages/sv_SE, languages/tr_TR/LC_MESSAGES/messages.mo, languages/tr_TR/LC_MESSAGES, languages/tr_TR, themes/ucan/css/build/add-ons/calendar.less, themes/ucan/css/build/add-ons, themes/ucan/css/build/blocks/date-navigation.less, themes/ucan/css/build/blocks/faq.less, themes/ucan/css/build/blocks/feature-template-hover-description.less, themes/ucan/css/build/blocks/feature.less, themes/ucan/css/build/blocks/image-slider.less, themes/ucan/css/build/blocks/image.less, themes/ucan/css/build/blocks/next-previous.less, themes/ucan/css/build/blocks/page-attribute-display.less, themes/ucan/css/build/blocks/page-list-option-buttons.less, themes/ucan/css/build/blocks/page-list-template-thumbnail-grid.less, themes/ucan/css/build/blocks/page-list.less, themes/ucan/css/build/blocks/page-title-option-byline.less, themes/ucan/css/build/blocks/page-title.less, themes/ucan/css/build/blocks/tags.less, themes/ucan/css/build/blocks/testimonial.less, themes/ucan/css/build/blocks/topic-list.less, themes/ucan/css/build/blocks, themes/ucan/css/build/bootstrap-3.2.0/mixins/alerts.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/background-variant.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/border-radius.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/buttons.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/center-block.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/clearfix.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/forms.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/gradients.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/grid-framework.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/grid.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/hide-text.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/image.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/labels.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/list-group.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/nav-divider.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/nav-vertical-align.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/opacity.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/pagination.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/panels.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/progress-bar.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/reset-filter.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/resize.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/responsive-visibility.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/size.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/tab-focus.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/table-row.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/text-emphasis.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/text-overflow.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/vendor-prefixes.less, themes/ucan/css/build/bootstrap-3.2.0/mixins, themes/ucan/css/build/bootstrap-3.2.0/alerts.less, themes/ucan/css/build/bootstrap-3.2.0/badges.less, themes/ucan/css/build/bootstrap-3.2.0/bootstrap.less, themes/ucan/css/build/bootstrap-3.2.0/breadcrumbs.less, themes/ucan/css/build/bootstrap-3.2.0/button-groups.less, themes/ucan/css/build/bootstrap-3.2.0/buttons.less, themes/ucan/css/build/bootstrap-3.2.0/carousel.less, themes/ucan/css/build/bootstrap-3.2.0/close.less, themes/ucan/css/build/bootstrap-3.2.0/code.less, themes/ucan/css/build/bootstrap-3.2.0/component-animations.less, themes/ucan/css/build/bootstrap-3.2.0/dropdowns.less, themes/ucan/css/build/bootstrap-3.2.0/forms.less, themes/ucan/css/build/bootstrap-3.2.0/glyphicons.less, themes/ucan/css/build/bootstrap-3.2.0/grid.less, themes/ucan/css/build/bootstrap-3.2.0/input-groups.less, themes/ucan/css/build/bootstrap-3.2.0/jumbotron.less, themes/ucan/css/build/bootstrap-3.2.0/labels.less, themes/ucan/css/build/bootstrap-3.2.0/list-group.less, themes/ucan/css/build/bootstrap-3.2.0/media.less, themes/ucan/css/build/bootstrap-3.2.0/mixins.less, themes/ucan/css/build/bootstrap-3.2.0/modals.less, themes/ucan/css/build/bootstrap-3.2.0/navbar.less, themes/ucan/css/build/bootstrap-3.2.0/navs.less, themes/ucan/css/build/bootstrap-3.2.0/normalize.less, themes/ucan/css/build/bootstrap-3.2.0/pager.less, themes/ucan/css/build/bootstrap-3.2.0/pagination.less, themes/ucan/css/build/bootstrap-3.2.0/panels.less, themes/ucan/css/build/bootstrap-3.2.0/popovers.less, themes/ucan/css/build/bootstrap-3.2.0/print.less, themes/ucan/css/build/bootstrap-3.2.0/progress-bars.less, themes/ucan/css/build/bootstrap-3.2.0/responsive-embed.less, themes/ucan/css/build/bootstrap-3.2.0/responsive-utilities.less, themes/ucan/css/build/bootstrap-3.2.0/scaffolding.less, themes/ucan/css/build/bootstrap-3.2.0/tables.less, themes/ucan/css/build/bootstrap-3.2.0/theme.less, themes/ucan/css/build/bootstrap-3.2.0/thumbnails.less, themes/ucan/css/build/bootstrap-3.2.0/tooltip.less, themes/ucan/css/build/bootstrap-3.2.0/type.less, themes/ucan/css/build/bootstrap-3.2.0/utilities.less, themes/ucan/css/build/bootstrap-3.2.0/variables.less, themes/ucan/css/build/bootstrap-3.2.0/wells.less, themes/ucan/css/build/bootstrap-3.2.0, themes/ucan/css/build/custom-design-classes/area-content-accent.less, themes/ucan/css/build/custom-design-classes/block-sidebar-padded.less, themes/ucan/css/build/custom-design-classes/block-sidebar-wrapped.less, themes/ucan/css/build/custom-design-classes/blog-entry-list.less, themes/ucan/css/build/custom-design-classes/recent-blog-entry.less, themes/ucan/css/build/custom-design-classes/testimonial-bio.less, themes/ucan/css/build/custom-design-classes, themes/ucan/css/build/fonts/blue-sky.less, themes/ucan/css/build/fonts/defaults.less, themes/ucan/css/build/fonts/night-road.less, themes/ucan/css/build/fonts/royal.less, themes/ucan/css/build/fonts, themes/ucan/css/build/mobile/navigation.less, themes/ucan/css/build/mobile, themes/ucan/css/build/body.less, themes/ucan/css/build/breadcrumb.less, themes/ucan/css/build/buttons.less, themes/ucan/css/build/captcha.less, themes/ucan/css/build/content.less, themes/ucan/css/build/errors.less, themes/ucan/css/build/footer.less, themes/ucan/css/build/header.less, themes/ucan/css/build/miscellaneous-styles.less, themes/ucan/css/build/mixins.less, themes/ucan/css/build/pagination.less, themes/ucan/css/build/reset.less, themes/ucan/css/build/search.less, themes/ucan/css/build, themes/ucan/css/presets/blue-sky.less, themes/ucan/css/presets/defaults.less, themes/ucan/css/presets/night-road.less, themes/ucan/css/presets/royal.less, themes/ucan/css/presets, themes/ucan/css/bootstrap-modified.css, themes/ucan/css/main.less, themes/ucan/css/styles.xml, themes/ucan/css, themes/ucan/elements/footer.php, themes/ucan/elements/footer_bottom.php, themes/ucan/elements/header.php, themes/ucan/elements/header_top.php, themes/ucan/elements, themes/ucan/images/background-slider-blue-sky.png, themes/ucan/images/background-slider-default.png, themes/ucan/images/background-slider-night-road.png, themes/ucan/images/background-slider-royal.png, themes/ucan/images/background.png, themes/ucan/images/ucan-logo-edit.png, themes/ucan/images/backgroundImage.jpg, themes/ucan/images, themes/ucan/blank.php, themes/ucan/default.php, themes/ucan/full.php, themes/ucan/left_sidebar.php, themes/ucan/page_forbidden.php, themes/ucan/page_not_found.php, themes/ucan/page_theme.php, themes/ucan/right_sidebar.php, themes/ucan/thumbnail.png, themes/ucan/view.php, themes/ucan/description.txt, themes/ucan, languages/da_DK/LC_MESSAGES/messages.mo, languages/da_DK/LC_MESSAGES, languages/da_DK, languages/de_DE/LC_MESSAGES/messages.mo, languages/de_DE/LC_MESSAGES, languages/de_DE, languages/el_GR/LC_MESSAGES/messages.mo, languages/el_GR/LC_MESSAGES, languages/el_GR, languages/es_PY/LC_MESSAGES/messages.mo, languages/es_PY/LC_MESSAGES, languages/es_PY, languages/fi_FI/LC_MESSAGES/messages.mo, languages/fi_FI/LC_MESSAGES, languages/fi_FI, languages/fr_FR/LC_MESSAGES/messages.mo, languages/fr_FR/LC_MESSAGES, languages/fr_FR, languages/it_IT/LC_MESSAGES/messages.mo, languages/it_IT/LC_MESSAGES, languages/it_IT, languages/ja_JP/LC_MESSAGES/messages.mo, languages/ja_JP/LC_MESSAGES, languages/ja_JP, languages/nb_NO/LC_MESSAGES/messages.mo, languages/nb_NO/LC_MESSAGES, languages/nb_NO, languages/nl_NL/LC_MESSAGES/messages.mo, languages/nl_NL/LC_MESSAGES, languages/nl_NL, languages/pl_PL/LC_MESSAGES/messages.mo, languages/pl_PL/LC_MESSAGES, languages/pl_PL, languages/pt_BR/LC_MESSAGES/messages.mo, languages/pt_BR/LC_MESSAGES, languages/pt_BR, languages/ru_RU/LC_MESSAGES/messages.mo, languages/ru_RU/LC_MESSAGES, languages/ru_RU, languages/sv_SE/LC_MESSAGES/messages.mo, languages/sv_SE/LC_MESSAGES, languages/sv_SE, languages/tr_TR/LC_MESSAGES/messages.mo, languages/tr_TR/LC_MESSAGES, languages/tr_TR, themes/ucan/css/build/add-ons/calendar.less, themes/ucan/css/build/add-ons, themes/ucan/css/build/blocks/date-navigation.less, themes/ucan/css/build/blocks/faq.less, themes/ucan/css/build/blocks/feature-template-hover-description.less, themes/ucan/css/build/blocks/feature.less, themes/ucan/css/build/blocks/image-slider.less, themes/ucan/css/build/blocks/image.less, themes/ucan/css/build/blocks/next-previous.less, themes/ucan/css/build/blocks/page-attribute-display.less, themes/ucan/css/build/blocks/page-list-option-buttons.less, themes/ucan/css/build/blocks/page-list-template-thumbnail-grid.less, themes/ucan/css/build/blocks/page-list.less, themes/ucan/css/build/blocks/page-title-option-byline.less, themes/ucan/css/build/blocks/page-title.less, themes/ucan/css/build/blocks/tags.less, themes/ucan/css/build/blocks/testimonial.less, themes/ucan/css/build/blocks/topic-list.less, themes/ucan/css/build/blocks, themes/ucan/css/build/bootstrap-3.2.0/mixins/alerts.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/background-variant.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/border-radius.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/buttons.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/center-block.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/clearfix.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/forms.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/gradients.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/grid-framework.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/grid.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/hide-text.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/image.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/labels.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/list-group.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/nav-divider.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/nav-vertical-align.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/opacity.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/pagination.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/panels.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/progress-bar.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/reset-filter.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/resize.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/responsive-visibility.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/size.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/tab-focus.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/table-row.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/text-emphasis.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/text-overflow.less, themes/ucan/css/build/bootstrap-3.2.0/mixins/vendor-prefixes.less, themes/ucan/css/build/bootstrap-3.2.0/mixins, themes/ucan/css/build/bootstrap-3.2.0/alerts.less, themes/ucan/css/build/bootstrap-3.2.0/badges.less, themes/ucan/css/build/bootstrap-3.2.0/bootstrap.less, themes/ucan/css/build/bootstrap-3.2.0/breadcrumbs.less, themes/ucan/css/build/bootstrap-3.2.0/button-groups.less, themes/ucan/css/build/bootstrap-3.2.0/buttons.less, themes/ucan/css/build/bootstrap-3.2.0/carousel.less, themes/ucan/css/build/bootstrap-3.2.0/close.less, themes/ucan/css/build/bootstrap-3.2.0/code.less, themes/ucan/css/build/bootstrap-3.2.0/component-animations.less, themes/ucan/css/build/bootstrap-3.2.0/dropdowns.less, themes/ucan/css/build/bootstrap-3.2.0/forms.less, themes/ucan/css/build/bootstrap-3.2.0/glyphicons.less, themes/ucan/css/build/bootstrap-3.2.0/grid.less, themes/ucan/css/build/bootstrap-3.2.0/input-groups.less, themes/ucan/css/build/bootstrap-3.2.0/jumbotron.less, themes/ucan/css/build/bootstrap-3.2.0/labels.less, themes/ucan/css/build/bootstrap-3.2.0/list-group.less, themes/ucan/css/build/bootstrap-3.2.0/media.less, themes/ucan/css/build/bootstrap-3.2.0/mixins.less, themes/ucan/css/build/bootstrap-3.2.0/modals.less, themes/ucan/css/build/bootstrap-3.2.0/navbar.less, themes/ucan/css/build/bootstrap-3.2.0/navs.less, themes/ucan/css/build/bootstrap-3.2.0/normalize.less, themes/ucan/css/build/bootstrap-3.2.0/pager.less, themes/ucan/css/build/bootstrap-3.2.0/pagination.less, themes/ucan/css/build/bootstrap-3.2.0/panels.less, themes/ucan/css/build/bootstrap-3.2.0/popovers.less, themes/ucan/css/build/bootstrap-3.2.0/print.less, themes/ucan/css/build/bootstrap-3.2.0/progress-bars.less, themes/ucan/css/build/bootstrap-3.2.0/responsive-embed.less, themes/ucan/css/build/bootstrap-3.2.0/responsive-utilities.less, themes/ucan/css/build/bootstrap-3.2.0/scaffolding.less, themes/ucan/css/build/bootstrap-3.2.0/tables.less, themes/ucan/css/build/bootstrap-3.2.0/theme.less, themes/ucan/css/build/bootstrap-3.2.0/thumbnails.less, themes/ucan/css/build/bootstrap-3.2.0/tooltip.less, themes/ucan/css/build/bootstrap-3.2.0/type.less, themes/ucan/css/build/bootstrap-3.2.0/utilities.less, themes/ucan/css/build/bootstrap-3.2.0/variables.less, themes/ucan/css/build/bootstrap-3.2.0/wells.less, themes/ucan/css/build/bootstrap-3.2.0, themes/ucan/css/build/custom-design-classes/area-content-accent.less, themes/ucan/css/build/custom-design-classes/block-sidebar-padded.less, themes/ucan/css/build/custom-design-classes/block-sidebar-wrapped.less, themes/ucan/css/build/custom-design-classes/blog-entry-list.less, themes/ucan/css/build/custom-design-classes/recent-blog-entry.less, themes/ucan/css/build/custom-design-classes/testimonial-bio.less, themes/ucan/css/build/custom-design-classes, themes/ucan/css/build/fonts/blue-sky.less, themes/ucan/css/build/fonts/defaults.less, themes/ucan/css/build/fonts/night-road.less, themes/ucan/css/build/fonts/royal.less, themes/ucan/css/build/fonts, themes/ucan/css/build/mobile/navigation.less, themes/ucan/css/build/mobile, themes/ucan/css/build/body.less, themes/ucan/css/build/breadcrumb.less, themes/ucan/css/build/buttons.less, themes/ucan/css/build/captcha.less, themes/ucan/css/build/content.less, themes/ucan/css/build/errors.less, themes/ucan/css/build/footer.less, themes/ucan/css/build/header.less, themes/ucan/css/build/miscellaneous-styles.less, themes/ucan/css/build/mixins.less, themes/ucan/css/build/pagination.less, themes/ucan/css/build/reset.less, themes/ucan/css/build/search.less, themes/ucan/css/build, themes/ucan/css/presets/blue-sky.less, themes/ucan/css/presets/defaults.less, themes/ucan/css/presets/night-road.less, themes/ucan/css/presets/royal.less, themes/ucan/css/presets, themes/ucan/css/bootstrap-modified.css, themes/ucan/css/main.less, themes/ucan/css/styles.xml, themes/ucan/css, themes/ucan/elements/footer.php, themes/ucan/elements/footer_bottom.php, themes/ucan/elements/header.php, themes/ucan/elements/header_top.php, themes/ucan/elements, themes/ucan/images/background-slider-blue-sky.png, themes/ucan/images/background-slider-default.png, themes/ucan/images/background-slider-night-road.png, themes/ucan/images/background-slider-royal.png, themes/ucan/images/background.png, themes/ucan/images/ucan-logo-edit.png, themes/ucan/images/backgroundImage.jpg, themes/ucan/images, themes/ucan/blank.php, themes/ucan/default.php, themes/ucan/full.php, themes/ucan/left_sidebar.php, themes/ucan/page_forbidden.php, themes/ucan/page_not_found.php, themes/ucan/page_theme.php, themes/ucan/right_sidebar.php, themes/ucan/thumbnail.png, themes/ucan/view.php, themes/ucan/description.txt, themes/ucan

# concrete5 Cache Settings
Block Cache - Off
Overrides Cache - Off
Full Page Caching - Off
Full Page Cache Lifetime - Only when manually removed or the cache is cleared.

# Server Software
Apache

# Server API
cgi-fcgi

# PHP Version
5.3.24

# PHP Extensions
apc, bcmath, calendar, cgi-fcgi, Core, ctype, curl, date, dba, dom, ereg, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, json, libxml, mbstring, mcrypt, mhash, mysql, mysqli, openssl, pcre, PDO, pdo_mysql, pdo_sqlite, Phar, pspell, Reflection, session, SimpleXML, soap, SPL, SQLite, sqlite3, standard, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, zlib.

# PHP Settings
max_execution_time - 30
apc.max_file_size - 1M
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 60
max_input_vars - 1000
memory_limit - 64M
post_max_size - 33M
safe_mode - Off
safe_mode_exec_dir - <i>no value</i>
safe_mode_gid - Off
safe_mode_include_dir - ~
sql.safe_mode - Off
upload_max_filesize - 32M
mysql.max_links - Unlimited
mysql.max_persistent - Unlimited
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 1440
soap.wsdl_cache_limit - 5
safe_mode_allowed_env_vars - PHP_ LANG LANG_
safe_mode_protected_env_vars - LD_LIBRARY_PATH

Browser User-Agent String

Mozilla/5.0 (Windows NT 6.1; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.