How to connect weblog entry to gallery category?
Posted: 30 May 2008 06:00 PM   [ Ignore ]  
Grad Student
Avatar
Rank
Total Posts:  98
Joined  06-22-2007

I finally decided to use Relating Entries as a solution to my site’s articles. After successfully implementing the relationship, I found that you can connect only one gallery entry from the gallery in a weblog entry. May aim was to associate complete gallery category with some particular entry.

To make things more clear, here is one of my articles that consists a site of images from a specific gallery category.

So, is this possible with the Relating Entries, or should I continue do it manually?

Profile
 
 
Posted: 31 May 2008 04:10 PM   [ Ignore ]   [ # 1 ]  
Summer Student
Total Posts:  9
Joined  11-05-2007

I’m not an expert in EE but a possible solution for this would be to create a custom field in your weblog and insert the appropriate gallery category id there, then inside the weblog:entries tag you would insert the gallery:entries tag and you would pass the value of the custom field to the category id, thus selecting all the photos you wish to display. The downside of this is that you won’t be able to insert text between your photos, but it could be a solution. Hope it helps.

{exp:weblog:entries entry_id="3" weblog="default_site" dynamic="off"}
{title}
{body}
{exp
:gallery:entries gallery="{gallery_name}" category_id="{phgall}"}
{
/exp:weblog:entries}

<table class="tableBorder" cellpadding="6" cellspacing="1" border="0" width="600px">

{entries}

{row_start}
<tr>{/row_start}

{row}
<td class="thumbs">

<
div class="title">{title}</div>
</
td>
{/row}

{row_blank}
<td class="thumbs">&nbsp;</td>{/row_blank}

{row_end}
</tr>{/row_end}

{
/entries}

</table>

{/exp:gallery:entries}

Profile
 
 
Posted: 31 May 2008 05:04 PM   [ Ignore ]   [ # 2 ]  
Grad Student
Avatar
Rank
Total Posts:  98
Joined  06-22-2007

Thanks Isabel, I thought about this solution a while ago, so maybe I’ll try to use it.

Profile
 
 
Posted: 31 May 2008 05:08 PM   [ Ignore ]   [ # 3 ]  
Summer Student
Total Posts:  9
Joined  11-05-2007

smile You’re welcome. I hope you find a good solution!

Profile
 
 
Posted: 06 August 2008 02:06 PM   [ Ignore ]   [ # 4 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  759
Joined  03-22-2004

Robin has done a lot of this work for you already by creating a little known about extension which basically creates a dropdown menu in the publish page- options are the gallery categories- select one and the category id is entered into the field.  Saves having to flip over to the gallery and look it up and adding gallery tags inside a weblog tag which will add to you queries.

Custom Field
Create a custom field with input text as type and give it a name like {gallerycategory}. On your field group page which lists your custom fields, hover your mouse over the field you created and look at the stats bar below which gives a long url and at the very end is your field_id. Make note of that.

Download the extension here. Be sure to change the 2 items mentioned

You’ll need to open up the extension- and on line 33 alter:
$alter_field = 32;

The number?  That should be the field id of the text field where you want the category id to be inserted.  That field will be ‘replaced’ on the user side by a dropdown filled with the category names.

On line 37 you’ll need to alter:
$results = $DB->query(“SELECT cat_id, gallery_id, cat_name FROM exp_gallery_categories WHERE gallery_id=2 ORDER BY cat_name”);

Change gallery_id=2 to equal the id number of whatever gallery you want to pull the categories from.

Change it, save it, upload it to the extensions folder- then enable the extension.

You can now use {gallerycategory} to grab your images from the specific category

Profile
 
 
Posted: 06 August 2008 10:40 PM   [ Ignore ]   [ # 5 ]  
Summer Student
Total Posts:  6
Joined  07-22-2008

you rock!

thanks.

im having a hard time getting it to work for now, but ill ask in the other thread.


high five sir!

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64909 Total Logged-in Users: 42
Total Topics: 81855 Total Anonymous Users: 26
Total Replies: 440069 Total Guests: 206
Total Posts: 521924    
Members ( View Memberlist )