1
WickedLogic
Design choice question: Why Print/Echo ?

I've been reading up and looking at code in xoops. Despite the oop side of things, there seems a strange amount of reliance on echo/print and order of content generating pieces.

Was this a design thing? Is there a reason why that there is no output object being used historical or otherwise. Would seem to suggest caching and templates might be much easier, i think...

Instead of:
echo 'new content';
print 'new content2';

Like:
$tmpvar = 'new content';
$tmpvar .= 'new content2';
print($tmpvar);

or Object based:
$request->content = 'new content';
$request->content .= 'new content2';
$request->print();

2
hervet
Re: Design choice question: Why Print/Echo ?
  • 2004/9/3 18:31

  • hervet

  • Friend of XOOPS

  • Posts: 2267

  • Since: 2003/11/4


Hi,

For the user's part you can, no you have to use Smarty, so you have objects, and for the admin part, you can use XoopsForms, that's also an object.

Bye,
Hervé

3
Catzwolf
Re: Design choice question: Why Print/Echo ?
  • 2004/9/3 18:37

  • Catzwolf

  • Home away from home

  • Posts: 1392

  • Since: 2007/9/30


If you are refering to the user side of Module ie non admin, there really shouldn't be echo or print commands used (where possible).

As yet, the admin side is non templated and we cannot seperate the logic from the content and this is where the echo print statements are required.

4
Dave_L
Re: Design choice question: Why Print/Echo ?
  • 2004/9/3 20:39

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Or (to make it more confusing ) you can do:

ob_start();
echo 'some content';
echo 'some more content';
$output = ob_get_contents();
ob_end_clean();

echo $output;

5
Mithrandir
Re: Design choice question: Why Print/Echo ?

Quote:

Dave_L wrote:
Or (to make it more confusing ) you can do:

ob_start();
echo 'some content';
echo 'some more content';
$output = ob_get_contents();
ob_end_clean();

echo $output;
Which is actually what is done - the last part of the header.php and the first part of the footer.php does exactly that.

6
Catzwolf
Re: Design choice question: Why Print/Echo ?
  • 2004/9/3 22:36

  • Catzwolf

  • Home away from home

  • Posts: 1392

  • Since: 2007/9/30


Quote:

Mithrandir wrote:
Quote:

Dave_L wrote:
Or (to make it more confusing ) you can do:

ob_start();
echo 'some content';
echo 'some more content';
$output = ob_get_contents();
ob_end_clean();

echo $output;
Which is actually what is done - the last part of the header.php and the first part of the footer.php does exactly that.


Whoops,

Mental note to self (Scott read the question correctly in future lol).

Login

Who's Online

362 user(s) are online (285 user(s) are browsing Support Forums)


Members: 0


Guests: 362


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits