dongtuo8170 2012-08-28 19:00
浏览 128
已采纳

Drupal 7将内容类型url设置为自定义值

I am using Drupal 7 and have created a custom content type and a view that displays those content types. What I want to do is override the url to the node in the teaser view. My specific use case is this:

I have a support view that displays support content types. When I view that page, I see the teasers for the support content types I have created: Safety, FAQ, Ticketing. Safety and FAQ link to their nodes as expected. What I am trying to accomplish, is have the teaser and image for ticketing there, but have it link to my external ticketing portal. Essentially, I would like to have a checkbox when creating content of this type that allows me to link to external url. I do have the link module installed, but there is no way for me to apply that field to the url of the title.

I have spent a while googling around trying to find the answer, but without much success. If there is nothing available to do this already, I wouldn't mind building a module and submitting it to the community. Just want to make sure I'm not missing anything.

Thanks in advance.

UPDATE

Here are the steps I took using the answer given below:

  1. Install the link module: http://drupal.org/project/link
  2. Create a content type, add a field for link
  3. Add new content of that type and add the url you want to link to in the link field
  4. Create a view and filter by that content type
  5. Under format, i'm using format: "grid" with show: "fields"
  6. Add a field for the Content: link field you created FIRST* in the list. Set to Exclude from display and Formatter: URL, as plain text
  7. Add a title field and deselect "Link this field to the original piece of content" click on "rewrite results" and select "rewrite the output of this field". Enter <a href="[field_link_to]">[title]</a> in the text field where [field_link_to] is the name of the link field as described in the "replacement patterns" dropdown below it.
    • If you do not have the link field in your list of fields FIRST, the token will not be available to the fields below it.
    • In your Content Type > Manage Fields > Link (edit) > Wrapper markup, make sure "no markup" is selected
  • 写回答

2条回答 默认 最新

  • dqqfuth6736 2012-08-28 19:14
    关注

    You can alter the display of the view using the rewrite options. Make sure your display type is set to 'fields'. Then include the fields you want to display; title, teaser, image.

    In the field configuration of the title field, choose 'rewrite results'. there you can enter the following <a href="example.com">[title]</a> That should overrule the title.

    Also make sure to uncheck 'link the field to it's node'.

    UPDATE: You might have to create a second view for this... To prevent editing the other two elements.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测