Ruby Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesRuby Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 15th, 2010, 09:47 PM
77huntley 77huntley is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2010
Posts: 1 77huntley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 m 5 sec
Reputation Power: 0
Unhappy Know nothing about Ruby, can't modify files on a website (index.html.erb??!)

Hello,

I'm really confused. I know basic html, unix, php, few other things.
I need to add META tags for a friend, different tags on every page of his site.

Got into his FTP and his directory structure just boggled me.
He runs nginx.

After much searching I found all the files I needed with .erb extensions appended to them. There's a gems folder, so I'm guessing Ruby is involved.
When I go to ..../sitename_main/stable/app/views/main/ (damn that's deep in the tree!)

I find files like index.html.erb.
So I decided to try to edit these to add meta tags.
Didn't work.. the <title> and <head> area's of the page aren't changeable from there, the index.html.erb file just starts with:

Code:
<body id="index"> 
<div class="full_page">
    <div class="main_cont">
      <div class="top_banner">
        <%= render :partial => "main/top_ban" %>
      </div>
      <div class="index_images">
        <img id="ban_1" src="images/index_banner.jpg"  width="936px"  height="290px" style="opacity: 0;"/>
        <img id="ban_2" src="images/index_banner2.jpg"  width="936px" height="290px" style="opacity: 0;"/>
        <img id="ban_3" src="images/index_banner3.jpg"  width="936px" height="290px" style="opacity: 0;"/>
        <img id="ban_4" src="images/index_banner4.jpg"  width="936px" height="290px" style="opacity: 0;"/>
        <img id="ban_5" src="images/index_banner5.jpg"  width="936px" height="290px" style="opacity: 0;"/>
      </div>
      <div class="top_menu">
      ........
      ........

........

How to I add meta tags (and titles) to each individual page?

Any help would be appreciated, thanks guys!!

Reply With Quote
  #2  
Old September 16th, 2010, 05:58 AM
L7Sqr L7Sqr is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2004
Location: Constant Limbo
Posts: 989 L7Sqr User rank is Major (30000 - 40000 Reputation Level)L7Sqr User rank is Major (30000 - 40000 Reputation Level)L7Sqr User rank is Major (30000 - 40000 Reputation Level)L7Sqr User rank is Major (30000 - 40000 Reputation Level)L7Sqr User rank is Major (30000 - 40000 Reputation Level)L7Sqr User rank is Major (30000 - 40000 Reputation Level)L7Sqr User rank is Major (30000 - 40000 Reputation Level)L7Sqr User rank is Major (30000 - 40000 Reputation Level)L7Sqr User rank is Major (30000 - 40000 Reputation Level)L7Sqr User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 2 Weeks 2 Days 22 h 45 m 6 sec
Reputation Power: 362
Send a message via AIM to L7Sqr
This sounds a lot like a Rails setup. Rails uses ERB (Ruby templating mechanism) extensively.

If you need to edit the head/title portions of the eventual file maybe you can look for the inclusion of that file you show in other sources. This is entirely a shot in the dark as I am unaware of your setup and dont know diddly about the inner workings of Rails. Consider the following
Code:
 $ cat foo.rb
#!/usr/bin/env ruby
puts "In Foo"
require 'bar.rb'

$ cat bar.rb
puts "Bar included"

$ ruby foo.rb
In Foo
Bar included

So you might have some success if you grep for something like
Code:
egrep -Rn "require index.html.erb"

Though, you may have more consistent reqults if you just read up on how Rails works and edit things the ways they suggest
__________________
True happiness is not getting what you want, it's wanting what you've already got.

My Blog

Reply With Quote
  #3  
Old September 21st, 2010, 04:10 AM
Trackno Trackno is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2010
Posts: 3 Trackno User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 29 m 36 sec
Reputation Power: 0
Is there advantages of Ruby compared to php? Don't know would it be profitable for me to learn it

Reply With Quote
  #4  
Old September 21st, 2010, 09:23 AM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 9th Plane (9000 - 9499 posts)
 
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
Posts: 9,406 Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Months 9 h 37 m 23 sec
Reputation Power: 4080
Most likely, the code is using a template. What you need to do is look here:

/sitename_main/stable/app/views/layouts

and see if there is a file here that has <html><head>...

Then, all you have to do is modify this file and make it accept parameters from the controller:
e.g.
Code:
<title><%= @title %> - My Site Name</title>
<meta name="keywords" content="<%= @meta_keywords %>" />
<meta name="description" content="<%= @meta_description %>" />

and then modify your controller file (which should be /sitename_main/stable/app/controllers/main.rb) and add the following into the different functions here:
Code:
@title = "Custom title"
@meta_keywords = "Something, something else"
@meta_description = "Fee fie fo fum"

You can modify the controller so that @title, @meta_keywords and @meta_description have a default value and then override in specific functions.
__________________
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne

Reply With Quote
  #5  
Old October 13th, 2010, 09:07 AM
andolasoft andolasoft is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2010
Location: San Jose
Posts: 21 andolasoft New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: 4 h 3 m 51 sec
Reputation Power: 0
ruby is a pure object oriented language

As compared to php, ruby is a pure Object oriented language. ruby possesses many metaprogramming attributes which can be used in rails development.

Reply With Quote
  #6  
Old October 15th, 2010, 05:51 PM
orvn orvn is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2010
Location: Toronto, Canada
Posts: 5 orvn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 11 m 7 sec
Reputation Power: 0
Hello! I had to re-register with a new username, as I was having problems with my old email account., I'm the same user who started this thread though.

Quote:
Originally Posted by Scorpions4ever
Most likely, the code is using a template. What you need to do is look here:

/sitename_main/stable/app/views/layouts

and see if there is a file here that has <html><head>...

Then, all you have to do is modify this file and make it accept parameters from the controller:
e.g.
Code:
<title><%= @title %> - My Site Name</title>
<meta name="keywords" content="<%= @meta_keywords %>" />
<meta name="description" content="<%= @meta_description %>" />

and then modify your controller file (which should be /sitename_main/stable/app/controllers/main.rb) and add the following into the different functions here:
Code:
@title = "Custom title"
@meta_keywords = "Something, something else"
@meta_description = "Fee fie fo fum"

You can modify the controller so that @title, @meta_keywords and @meta_description have a default value and then override in specific functions.


First of all, thanks SO much for the response.

When I go to ...sitename/stable/app/views/layouts
There is one file in the subdirectory, it is entitled application.html.erb.
Is this the file I'm looking for?

When I try to download it, all I get is an empty file..
Could it be that I just don't have access permissions or should I be taking a different course of action?

Thanks again!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesRuby Programming > Know nothing about Ruby, can't modify files on a website (index.html.erb??!)

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap