scripting algorith help / architecture questions
Posted: 16 May 2008 10:29 AM   [ Ignore ]  
Lab Assistant
RankRank
Total Posts:  128
Joined  08-06-2007

Hey all -

I have a corporate timeline page (here it is in development:

sample timeline

It is based on this general data structure:

<h1 class="dates_toggle">2003</h1>
div class="date_content">
<
ul>
<
li><a href="#">This is one line</a></li>
<
li><a href="#">This is another line</a></li>
<
li><a href="#">This is one more line</a></li>
<
li>This is one link</li>
</
ul>
</
div>

Here is my question -

I want to make this nice and dynamic, so I will make a weblog called “events” that takes a title and an image to replace to the right.  It also needs to be associated with a year.  I’d like to make a “years” weblog and set up an association.

I don’t know how to do the scripting - sort of something like this algorithm (in fake code!!) -

{exp:weblog:entries weblog="years" sort="desc"}
<h1 class="dates_toggle">{title}</h1> <-- this would be the year name
    
<div class="date_content">
     <
ul>
      
{exp:weblog:entries weblog="events"}
         [and have some reverse
-related entries thing here]
      {
/exp:weblog:entries}
     
</ul>
    </
div>
{/exp:weblog:entries}

I know this won’t work.  What I want is to loop through one weblog and also use it as a related entry in another.  Is this possible?  I know I can do it without automagic scaling.  I’d like to be able to simply add another “year” to the “year” weblog and the page will automatically take on another section.

Make sense?

Thanks!

Profile
 
 
Posted: 16 May 2008 11:17 PM   [ Ignore ]   [ # 1 ]  
Summer Student
Avatar
Total Posts:  5
Joined  05-16-2008

Actually. I would solve your problem like this…

Entry is stored in a weblog.
Each year is a category assigned to this weblog. (that can be selected upon publishing of entry).

If you set it up like above, you may use some code like the following to accomplish what you want:

{exp:weblog:categories weblog="yourweblog" style="linear"}
<h1 class="dates_toggle"><a href="{path=templates/portfolio-category/{category_id}}">{category_name}</a></h1>
<
div class="date_content">
<
ul>
{exp:weblog:entries weblog="yourweblog" category="{category_id}"}
<li><a href="#">{title}</a></li>
{/exp:weblog:entries}
</ul>
</
div>
{/exp:weblog:categories}

Profile
 
 
Posted: 17 May 2008 08:42 AM   [ Ignore ]   [ # 2 ]  
Lab Assistant
RankRank
Total Posts:  128
Joined  08-06-2007

Aaron -

Turns out I used two weblogs, one for each entry, one for each year.  Then, I associated the year weblog with the timeline weblog as a relationship.  it works with the following code - and beautifully!!

{exp:weblog:entries weblog="years" dynamic="off" orderby="title" sort="desc"}
  
<h1 class="dates_toggle">{title}</h1>
   <
div class="date_content">
     <
ul>             
      
{reverse_related_entries weblog="timeline_events"}
      
<li>{title}</li>
      
{/reverse_related_entries}
     
</ul>
   </
div>
{/exp:weblog:entries}

Profile
 
 
Posted: 17 May 2008 01:24 PM   [ Ignore ]   [ # 3 ]  
Summer Student
Avatar
Total Posts:  5
Joined  05-16-2008

That works too! Glad you found a solution—thanks for posting the code.

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 10:33 AM
Total Registered Members: 60726 Total Logged-in Users: 22
Total Topics: 73184 Total Anonymous Users: 11
Total Replies: 394698 Total Guests: 513
Total Posts: 467882    
Members ( View Memberlist )