GetSimple Support Forum

Full Version: Replace Echo to Return
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I think, will be better, if each function RETURN variable in main code, but do not ECHO.
Because you will operate with return value in main code.

Simple ex: I have removed link in header to main page, when page is main, for it I have replace Echo to Return in functions get_site_name() and get_site_url()

Code:
<?php
function get_site_url() {
    global $SITEURL;
    return $SITEURL;
}
function get_site_name() {
    global $SITENAME;
    return stripslashes($SITENAME);
} ?>
<h1><?php
if ($url == 'index')
    echo get_site_name();
else
    echo '<a href="'.get_site_url().'">'.get_site_name().'</a>';
?></h1>