Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to make return work
#6
Hi,
Thanks for stepping in,
sorry I forgot to mention that I am building with the 3.3.16

What I could find is returnPageContent('slug');
This works fine for 1 language

The i18n plugin has return_i18n_component('slug') but it returns the output unprocessed
(includes the php tags, quotes and semicolon)

=======================================================

Yes the best working solution seems to make use of PHP output buffering
It works also nice with multi-language and it even allows
chaining api calls:

Working example on a template file:

PHP Code:
<?php
ob_start
();
get_page_content();
get_i18n_component('test');
$maincontent .= ob_get_clean();
?>

On the front:

Code:
<div class="">
<?php echo $maincontent ; ?>
</div>

Works flawlessly ...

===========================================================

It is said that you have to be careful with ob memory usage

So I checked with memory_get_usage()

PHP Code:
echo memory_get_usage() . "<br>";
ob_start();
get_page_content();
get_i18n_component('test');
$maincontent .= ob_get_clean();
echo 
memory_get_usage() . "<br>");
unset(
$maincontent);
echo 
memory_get_usage() . "<br>"


There is no memory usage problem at allĀ 

F.
Reply


Messages In This Thread
how to make return work - by Felix - 2021-02-06, 21:12:30
RE: how to make return work - by shawn_a - 2021-02-07, 01:50:01
RE: how to make return work - by shawn_a - 2021-02-07, 02:10:03
RE: how to make return work - by shawn_a - 2021-02-07, 02:22:26
RE: how to make return work - by shawn_a - 2021-02-07, 02:25:46
RE: how to make return work - by Felix - 2021-02-07, 04:59:02



Users browsing this thread: 1 Guest(s)