Hi everyone,
I’d like to create a set of pages having two fields per page: a body
and an image URL. The layout will centrally control the positioning
and formatting of the image across all pages, which is why I don’t
want to embed the image separately in each page.
How do I do this? Do I manually create an “image” tab for each new
page, and then have my layout retrieve the URL from this image tab?
Adding the tab to the parent page doesn’t result in the children
inheriting it.
Also, I assume that each tab correlates to a VARCHAR in the database.
Is there a more efficient way to do this?
Thanks!
~joe
P.S. I’m an experienced web/software developer, but new to both Ruby
and Radiant.
Il giorno 13/lug/07, alle ore 21:39, Joe Lapp ha scritto:
Adding the tab to the parent page doesn’t result in the children
inheriting it.
I use DefaultPageParts extension:
http://darcs.bigchieflabs.com/radiant/extensions/default_page_parts/
rdoc/
Let me know if it is what you need!
Andrea F.
[email protected]
http://bigchieflabs.com/blog/
http://think.bigchief.it
Joe Lapp wrote:
Hi everyone,
I’d like to create a set of pages having two fields per page: a body
and an image URL. The layout will centrally control the positioning
and formatting of the image across all pages, which is why I don’t
want to embed the image separately in each page.
How do I do this? Do I manually create an “image” tab for each new
page, and then have my layout retrieve the URL from this image tab?
That is one way to do it.
Adding the tab to the parent page doesn’t result in the children
inheriting it.
Make sure that you include inherit=“true” in the layout: <r:content
part=“image” inherit=“true” />
This will force Radiant to look through parent pages until it finds a
matching part with that name.
Also, I assume that each tab correlates to a VARCHAR in the database.
Is there a more efficient way to do this?
Actually, it corresponds (roughly) to a record in a separate table in
the database. There are more efficient ways, but they would involve
writing an extension.
Andrea’s DefaultPageParts might help you with automatically creating the
tabs.
Sean
Can anyone confirm for me the appropriate way to install an extension?
Do I just run rake from the extension’s directory? I can find web
pages on creating extensions but not on installing them. (Maybe it’s
obvious to people familiar with rails; I’m new to ruby/rails.)
If running rake is supposed to suffice, can anyone explain why it
didn’t work for me? I now have the extension listed on my extensions
page, but the DefaultPageParts page type doesn’t show for any page.
See rake output below. Thanks!
~joe
Hi Andrea. Your extension looks perfect. I used darcs to pull it
into the extensions directory. But heck if I know how to get the
thing installed. An update on the admin page did nothing, and running
rake from the default_page_parts directory resulted in this:
(in /var/www/ecotwined/vendor/extensions/default_page_parts)
/usr/bin/ruby1.8 -Ilib:lib
“/usr/lib/ruby/1.8/rake/rake_test_loader.rb”
“test/functional/default_page_parts_extension_test.rb”
Extensions cannot be used until Radiant migrations are up to date.
Loaded suite /usr/lib/ruby/1.8/rake/rake_test_loader
Started
EF
Finished in 0.006811 seconds.
-
Error:
test_initialization(DefaultPagePartsExtensionTest):
NameError: uninitialized constant
DefaultPagePartsExtensionTest::DefaultPagePartsExtension
/var/lib/gems/1.8/gems/radiant-0.6.2/vendor/rails/activerecord/lib/…/…/activesupport/lib/active_support/dependencies.rb:477:in
const_missing' ./test/functional/default_page_parts_extension_test.rb:11:in
test_initialization’
-
Failure:
test_this_extension(DefaultPagePartsExtensionTest)
[./test/functional/default_page_parts_extension_test.rb:7]:
Flunked.
2 tests, 1 assertions, 1 failures, 1 errors
rake aborted!
Command failed with status (1): [/usr/bin/ruby1.8 -Ilib:lib
"/usr/lib/ruby/…]