joined:June 2, 2006
I hope I called it right in the subject...
Sometimes I use PHP to store HTML code. For example, to echo the code for some social buttons. I do it in this way:
print '<!-- AddThis Buttons BEGIN -->
<!-- AddThis Buttons END -->';
Then I include this into HTML pages. Yeah, a template does the same, but I may have multiple templates or whatever, so this ensures I do the change in a single place when needed, and no need to upload HTML files, but the tiny PHP code only.
Anyway, in the same fashion I would like to maintain several, call them blurbs, in a single PHP file, and call a certain blurb by using PHP include command. For example:
$blurb1 = print 'blurb1 text';
$blurb2 = print 'blurb2 text';
$blurb3 = print 'blurb3 text';
... and so on...
Then, in my HTML, I do <?php echo $blurb1 ?>
Now, what would be the simplest way of doing this?
Is it that I include the whole script in the beginning of the HTML, and then call echo on 1, 2, or 3, or I just call each blurb directly however and whenever I want?
For example, how do I call "echo $blurb2" directly in one line?