• mccamten

    (@mccamten)


    Hi there –

    I would like to add a hyperlink to a field in the [pdb_list] display. For instance, I want to be able to list a company, and instead of having to set up a separate column listing their web address, simply have their company name be clickable to go directly to their company website. Is this possible?

    If so, as another step further would it be possible to grab that web address directly from their sign-up form so this could be automated?

    Thanks for the help!

Viewing 1 replies (of 1 total)
  • Plugin Author xnau webdesign

    (@xnau)

    Yes, and the answer is pretty much the same as for your last question. You can build this into your custom template. It’s pretty easy once you get how it works.

    Looking at the Using the PDb_Template class in your custom templates article for reference, in the example there is a method for printing a field like this:

    <?php $this_business->print_field('business_name'); ?>

    Well there is also a method for printing a field with a link, which you would do like this:

    <?php $this_business->print_with_link( 'business_name', $this_business->get_value('business_url') ); ?>

    Notice that it grabs the “business_url” field value and uses it as the link for the business name.

    Also note that the example os for a single record display, but you want to build a list template. The list is really no different, it’s just that there is a loop that displays each record. Within that loop, you can do any of the things with displaying the record that you can do in a single record display, so everything in the example will apply, only it’s usually for a much smaller number of fields.

Viewing 1 replies (of 1 total)
  • The topic ‘hyperlink a display field’ is closed to new replies.