[Radiant] Checking for an asset existence
Ruben D. Orduz
aminox at gmail.com
Thu Dec 14 13:35:51 CST 2006
coffee...yeah right! :)
On 12/14/06, Sean Cribbs <seancribbs at gmail.com> wrote:
> I apologize... File.expand() should be File.expand_path(). That's what I
> get for drinking too much coffee!!
>
> Sean
>
>
> On 12/14/06, Sean Cribbs < seancribbs at gmail.com> wrote:
> > How about this:
> >
> > The Radius code:
> >
> > <r:if_public_file_exists path="/images/home- highlight.jpg">
> > <img src="/images/home-highlight.jpg" />
> > </r:if_public_file_exists>
> >
> >
> > The tag definition:
> >
> > tag "if_public_file_exists" do |tag|
> > tag.expand if File.exists?(File.expand(File.join(RAILS_ROOT, "public",
> tag.attr['path'])))
> > end
> >
> > Of course you could change the nomenclature however you like, and a few
> unit tests wouldn't hurt, but that's the basic outline.
> >
> > Sean
> >
> >
> >
> > On 12/14/06, Brian Sam-Bodden < bsbodden at integrallis.com> wrote:
> > >
> > >
> > > Fellow Radiant users:
> > > I have a site for which I have a "highlights" image for certain
> pages. Sort of a branding/marketing image. I've put those images in a
> /highlights directory and named them after the page they belong in, e.g.
> home ==> home-highlight.jpg. Of course, for the pages that don't have an
> image I get the always unpleasant image placeholder icon in Safari and IE.
> If there a easy way to use something like a <if-asset-exists/> or
> <if-file-exists/> type of tag? So that I can only include that <img/> tag
> for those pages that have one. I can do something with Javascript but
> that's just not pretty. Any ideas?
> > >
> > > Thanks,
> > > Brian
> > >
> > >
> > > _______________________________________________
> > > Radiant mailing list
> > > Post: Radiant at lists.radiantcms.org
> > > Search: http://radiantcms.org/mailing-list/search/
> > > Site:
> http://lists.radiantcms.org/mailman/listinfo/radiant
> > >
> > >
> >
> >
>
>
> _______________________________________________
> Radiant mailing list
> Post: Radiant at lists.radiantcms.org
> Search: http://radiantcms.org/mailing-list/search/
> Site:
> http://lists.radiantcms.org/mailman/listinfo/radiant
>
>
More information about the Radiant
mailing list