[GoLUG] DRY in my 444domains.com system
Kyle Terrien
kyle at terren.us
Thu Dec 12 12:02:12 EST 2024
On Thu, Dec 12, 2024 at 01:50:07AM -0500, Steve Litt wrote:
> So the one and only place the price is quantified is in the line:
>
> span.bux::before{content: "$54,321.00";}
>
> Once the preceding CSS line is stated, anywhere I want to put the price
> can be displayed simply by the following HTML tag sequence:
>
> <span class="bux"></span>
>
> And as far as the 444domains.com builder script, all it needs to do is
> look in the Moretime.Com (or whatever domain I'm selling with a website)
> index.html for "span.bux::before{content:", and then capture the string
> that follows. In the 444domains.com builder script I can strip out the
> dollar sign and commas and turn it into a number for sorting.
>
> Kinda slick, huh?
That’s interesting. I suppose you can move all the prices into a CSS
“data file”.
So, you could have http://moretime.com/prices.css contain
span.bux::before{content: "$54,321.00";}
And then from both moretime.com/index.html and
444domains.com/index.html:
<link rel="stylesheet" href="http://moretime.com/prices.css" />
This way, your price data is completely separate from presentation
(which is very funny considering this is all CSS), and there is no
JavaScript involved.
--
[*] Kyle Terrien
Run GNU/Linux, avoid orgs who hate you,
Love justice, and hate iniquity.
https://terren.us/
More information about the GoLUG
mailing list