Jump to content

Search the Community

Showing results for tags 'render()'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Categories

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 3 results

  1. Is it somehow possible to let page->render() use global variables? I want to render subpages in a template, which works fine for some cases. The problem: In the template there is an include, depending on a variable, which is set in the header. in the first head/ first template: $mobile = true; foreach($landingpage->children as $child) { echo $pages->get($child->id)->render(); } and in the template: include_once("./header.php"); if ($isMobile) {include("./mobile.inc");} but page->render() will (of course) not recognize the unknown $mobile variable. is there a way to render the page with all its variables? Best, Jan
  2. Hello for all, I try to find solution for my problem but without success. I want to create selectable "widgets" option (banners) inside pages, and for that try to use Ryan "Blogprofile" principle: 1. create page widgets (hidden) with blank ("no file") template 2. inside page Widgets, child pages are different type of content (image+link, text box with some link, link lists etc...) 3. every "banner" has it's own template with markup Inside Home page I created page field type (asmSelect) and set that selectable parent template is "widgets". And all that works, no any problems with administration - I can select desired widget/banner. Because some desired eg. "Home" page doesn't know what kind of content is some widget (image+link, or text box with link, some list etc...) I use this in _main.php // _main.php $widgets = $page->widgets; if(!$widgets || !count($widgets)) $widgets = $homepage->widgets; foreach($widgets as $widget) { echo $widget->render(); // echo $widget shows correct ID } And some "banner" inside banner template has this (example): // banner.php $out = "<h4>{$page->title}</h4>"; echo $out; But I have problem that page (website) not load? Inside errors log ("site/assets/logs") I don't have any problem, everything is clean. My opinion is that I don't use correctly render() method??? My template structure is like latest PW (2.5.3) multilanguage profile. Thanks for any help.
  3. So we have a project setup that has added a module that uses the addHookAfter('save') functionality. Essentially the goal is after a we actually "Save" the page options in the backend of PW we grab specific fields we have created and do an API call to an email service which includes doing a $page->render() to grab the full html for the page we are editing and send that along as the body of that email. The issue I am seeing when I actually view the page via the browser there are images that are showing correctly from a loop of articles but when I do the render I am only getting the path to the image like for example if the image url is: /site/assets/files/2123/feature_car.jpg I am only getting via the $page->render() instead of the full path: /site/assets/files/2123/ The section that this is happening is running a loop on articles inside of the template file and is causing the error is similar to this. The problem is happening with this part of the code: <?php echo base_url().$a->featured_image->url; ?> Heres the overall code: <?php $related_articles = $pages->get(1007)->children("template=article,is_national=1,related_edition={$pages->get(1021)->related_edition},related_categories!={$pages->get(1132)},sort=-date,include=all"); if ($related_articles->count()) { foreach ($related_articles as $a) { ?> <table cellpadding="0" cellspacing="0" width="100%"> <tr> <td> <a href="<?php echo base_url().$a->url; ?>" title="Learn More: <?php echo $a->title; ?>" target="_blank"><?php echo ($a->headline != '') ? $a->getUnformatted("headline") : $a->title; ?></a> <?php $suffix = ' <a href="'.base_url().$a->url.'" target="_blank" style="text-decoration: none;" title="Learn More: '.$a->get->title.'">Learn More »</a>'; if ($a->featured_image) { ?> <table cellpadding="0" cellspacing="0" border="0" width="100%" style="margin-bottom: 10px;"> <tr> <td> <?php if ($a->featured_image->url->description != '') { ?> <a href="<?php echo $a->featured_image->url->description; ?>" title="<?php echo $a->get('headline|title'); ?>"><img src="<?php echo base_url().$a->featured_image->url; ?>" alt="<?php echo $a->get('headline|title'); ?>" border="0" /></a> <?php } else { ?> <img src="<?php echo base_url().$a->featured_image->url; ?>" alt="<?php echo $a->get('headline|title'); ?>" border="0" /> <?php } ?> </td> <td valign="top"><p style="font-family: Arial, sans-serif; font-size: 13px; color: #555555; line-height: 16px; margin-top: 0; margin-bottom: 10px;"><?php echo (trim($a->summary)) ? $a->summary.$suffix : truncate($a->body, 250, '..'.$suffix); ?></p></td> </tr> </table> <?php } else { ?> <p style="font-family: Arial, sans-serif; font-size: 13px; color: #555555; line-height: 16px; margin-top: 0; margin-bottom: 10px;"><?php echo (trim($a->summary)) ? $a->summary.$suffix : truncate($a->body, 250, '..'.$suffix); ?></p> <?php } ?> </td> </tr> </table> <?php } } ?>
×
×
  • Create New...