C
Chad Perrin
NOTE: I'll try one more time. For some reason, this message hasn't
been getting through. It occurred to me that the mailing list might be
discarding messages with (X)HTML in them, so I replaced all greater-than
and less-than symbols with the corresponding bracket symbols. Please
pretend, while reading this, that it's all valid XHTML -- and please
forgive me if all three messages ultimately make it through.
I've been playing with eruby a little bit -- a VERY LITTLE bit, mind
you. I haven't gotten far yet.
It seems like an excellent way to finally get away from PHP in certain
types of work I do. The problem is that some of the concepts of PHP
don't seem to translate directly, and the only howtos I'm able to find
for eruby are anemic at best. There's plenty of stuff about how to
install it, and precious little about how to make use of it.
My current frustration is figuring out how to achieve the following:
1. an index.rhtml page that defines some variables
2. a template.whatever page that contains an XHTML page with evaluation
of ruby variables defined in the index.rhtml page to produce
page-specific content
In PHP, it would be something like the following example.
index.php:
[?php
$title = "Home";
require_once('template.php');
?]
template.php:
So . . . ideas? How would I go about achieving the same results with
eruby? Unless and until I can figure this out, there's a HUGE roadblock
in my way of the application of the DRY principle.
been getting through. It occurred to me that the mailing list might be
discarding messages with (X)HTML in them, so I replaced all greater-than
and less-than symbols with the corresponding bracket symbols. Please
pretend, while reading this, that it's all valid XHTML -- and please
forgive me if all three messages ultimately make it through.
I've been playing with eruby a little bit -- a VERY LITTLE bit, mind
you. I haven't gotten far yet.
It seems like an excellent way to finally get away from PHP in certain
types of work I do. The problem is that some of the concepts of PHP
don't seem to translate directly, and the only howtos I'm able to find
for eruby are anemic at best. There's plenty of stuff about how to
install it, and precious little about how to make use of it.
My current frustration is figuring out how to achieve the following:
1. an index.rhtml page that defines some variables
2. a template.whatever page that contains an XHTML page with evaluation
of ruby variables defined in the index.rhtml page to produce
page-specific content
In PHP, it would be something like the following example.
index.php:
[?php
$title = "Home";
require_once('template.php');
?]
template.php:
HTML:
[head]
[title]Welcome [?php echo $title ?][/title]
[/head]
[body]
[p]blah blah blah[/p]
[/body]
So . . . ideas? How would I go about achieving the same results with
eruby? Unless and until I can figure this out, there's a HUGE roadblock
in my way of the application of the DRY principle.