dongyun51582 2011-07-06 10:56
浏览 40
已采纳

表达式引擎 - 有关类别条目的帮助

OK, I have set up channel for the client to add projects. The way it works is simple:

I have a category page that displays all of the projects from the chosen category.

I then have a title_permalink page that displays a project, on this page there are 6 most recent related projects that are from that category, each linking to a projects/view page. On this page it displays the project and again, the SAME 6 most recent related projects.

I need to change the 6 recent related projects to be 6 PREVIOUS projects (from the category) dependant on which project has been chosen? For example, I have 20 projects sorted by date entered, I click on number 11 which was entered on Friday at 09:30. I need the view page to display the PREVIOUS 6 projects (by date&time) dependant on which project page you are on.

I have searched high and low but haven't found any help. I'm not asking someone to give me the answer. I just need pointed in the right direction as to the right solution for this.

The code for my project (title_permalink) page is:

<div id="projectView">
{exp:channel:entries channel="project"}
{exp:imgsizer:size src="{project_image}" width="980px" height="450px"}
<img src="{sized}" width="{width}" height="{height}"/>
{/exp:imgsizer:size}
<div id="projectView_overlay"></div>
<div id="projectView_content">
    <h3>{title}</h3>
    <p class="projectView_floatLeft"><b>Client:</b> {project_client} &ndash; <b>Value:</b> £{project_value} &ndash; <b>Duration:</b> {project_duration} weeks &ndash; <b>Architect:</b> {project_architect}</p>
    <p class="projectView_floatRight" style="color:#fff; font-size: 12.5px; font-weight:bold; margin-bottom: 5px;">{categories}<a href="{path='projects/list'}" style="color:#fff;"><< Back to<br />{category_name}</a>{/categories}</p>
</div>
{/exp:channel:entries}

<br style="clear:both"/>
</div><!--END PROJECT VIEW-->

<ul id="filmStrip">
    {exp:channel:entries start_on="{entry_date format="%Y-%m-%d %H:%i"}" channel="project" limit="6" category_group="1" related_categories_mode="yes" custom_fields="yes"}
    <li>
    {exp:imgsizer:size src="{project_image}" height="68px" width="137px"}
    <a href="{title_permalink='projects/view'}"><img src="{sized}" height="{height}" width="{width}" alt=""/></a>
    {/exp:imgsizer:size}
    <a href="{title_permalink='projects/view'}"><p class="thumbTitle">{title}</p></a>
    </li>
    {/exp:channel:entries}
</ul><!--END FILM STRIP-->

Thanks for any help!

  • 写回答

2条回答 默认 最新

  • dongya3627 2011-07-06 13:19
    关注

    The one flaw in Dan's answer is that he's nesting two channel:entries tags. That can lead to disaster. You need to embed the "related" template. Also, I think you want stop_before, not start_on. Try this modified code:

    <div id="projectView">
    {exp:channel:entries channel="project"}
        {exp:imgsizer:size src="{project_image}" width="980px" height="450px"}
    <img src="{sized}" width="{width}" height="{height}"/>
    {/exp:imgsizer:size}
    <div id="projectView_overlay"></div>
    <div id="projectView_content">
        <h3>{title}</h3>
        <p class="projectView_floatLeft"><b>Client:</b> {project_client} &ndash; <b>Value:</b> £{project_value} &ndash; <b>Duration:</b> {project_duration} weeks &ndash; <b>Architect:</b> {project_architect}</p>
    <p class="projectView_floatRight" style="color:#fff; font-size: 12.5px; font-weight:bold; margin-bottom: 5px;">{categories}<a href="{path='projects/list'}" style="color:#fff;"><< Back to<br />{category_name}</a>{/categories}</p>
    </div>
    
    <br style="clear:both"/>
    </div><!--END PROJECT VIEW-->
    
    {embed="projects/related" stop_before="{entry_date format="%Y-%m-%d %H:%i"}"}
    {/exp:channel:entries}
    

    And projects/related looks like:

    {exp:channel:entries channel="project" limit="6" category_group="1" stop_before="{embed:stop_before}" related_categories_mode="yes" custom_fields="yes"}
    {if count == "1"}<ul id="filmStrip">{/if}
    <li>
    {exp:imgsizer:size src="{project_image}" height="68px" width="137px"}
    <a href="{title_permalink='projects/view'}"><img src="{sized}" height="{height}" width="{width}" alt=""/></a>
    {/exp:imgsizer:size}
    <a href="{title_permalink='projects/view'}"><p class="thumbTitle">{title}</p></a>
    </li>
    {if count == total_results}</ul>{/if}
    {/exp:channel:entries}
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么