PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.ruby > Source a javascript and stylesheet into rhtml file
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Source a javascript and stylesheet into rhtml file

Réponse
 
LinkBack Outils de la discussion
Vieux 15/09/2007, 05h47   #1
Tim Trampedach
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Source a javascript and stylesheet into rhtml file

Hi all,

I'm trying to do a quick dump of a javascript and style sheet located in
their respective /public directories into an rhtml file. I want to
include the entire text of the file in my rhtml file. How do I do this
quickly and efficiently? In PHP there's readfile, but I can't figure out
an equivalent call in ruby.

Thanks so much in advance!

Tim
--
Posted via http://www.ruby-forum.com/.

  Réponse avec citation
Vieux 15/09/2007, 06h10   #2
Phlip
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Source a javascript and stylesheet into rhtml file

Tim Trampedach wrote in message ne\

> I'm trying to do a quick dump of a javascript and style sheet located in
> their respective /public directories into an rhtml file.


<%=h File.read(RAILS_ROOT + '/public/javascript/my_source.js') %>

This is half introductory Ruby and half introductory Rails, so one might
consider reading a little of the excellent books on these subjects, offline,
for a while!

--
Phlip


  Réponse avec citation
Vieux 15/09/2007, 06h24   #3
James Britt
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Source a javascript and stylesheet into rhtml file

Phlip wrote:
> Tim Trampedach wrote in message ne\
>
>> I'm trying to do a quick dump of a javascript and style sheet located in
>> their respective /public directories into an rhtml file.

>
> <%=h File.read(RAILS_ROOT + '/public/javascript/my_source.js') %>
>
> This is half introductory Ruby and half introductory Rails, so one might
> consider reading a little of the excellent books on these subjects,
> offline, for a while!




Rails questions are better directed to Rails mailing list, where you'll
get better, faster, information.


--
James Britt

"Judge a man by his questions, rather than his answers."
- Voltaire

  Réponse avec citation
Vieux 15/09/2007, 15h36   #4
Gregory Seidman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Source a javascript and stylesheet into rhtml file

On Sat, Sep 15, 2007 at 02:24:59PM +0900, James Britt wrote:
> Phlip wrote:
>> Tim Trampedach wrote in message ne\
>>> I'm trying to do a quick dump of a javascript and style sheet located in
>>> their respective /public directories into an rhtml file.

>> <%=h File.read(RAILS_ROOT + '/public/javascript/my_source.js') %>
>> This is half introductory Ruby and half introductory Rails, so one might
>> consider reading a little of the excellent books on these subjects,
>> offline, for a while!

>
> Rails questions are better directed to Rails mailing list, where you'll get
> better, faster, information.


While Philip may have assumed that Tim was using Rails, there was nothing
in the original post to indicate that Rails is involved. It's just ERB to
produce HTML (in this case with embedded JS and CSS), which comes up in
other contexts.

> James Britt

--Greg


  Réponse avec citation
Vieux 18/09/2007, 03h16   #5
James Britt
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Source a javascript and stylesheet into rhtml file

Gregory Seidman wrote:

>
> While Philip may have assumed that Tim was using Rails, there was nothing
> in the original post to indicate that Rails is involved. It's just ERB to
> produce HTML (in this case with embedded JS and CSS), which comes up in
> other contexts.



Amazingly true.

My reply was to suggest a better place for Rails if this was in
fact part of a Rails matter.


--
James Britt

"I have the uncomfortable feeling that others are making a religion
out of it, as if the conceptual problems of programming could be
solved by a single trick, by a simple form of coding discipline!"
- Edsger Dijkstra

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 12h46.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,11834 seconds with 13 queries