Forum
Custom Content where the content has hyperlinks
Hi,
Apologies if this is in the documentation or forum somewhere but I couldn't find anything specific.
I'm pulling some regions from other pages into a listings page using custom content. This displays the info successfully. I would also like some of the content to be hyperlinked - in the example i created 'location-company-name' as a code block or text area and added a link but when it is brought into the listings page the tags are read as characters. Is there any way round this please?
<?php
perch_content_custom('location-region', array(
'page'=>'/*',
'template'=>'text-break.html',
));
?>
</div>
<div class="col-md-4 col-xs-4">
<h2>Company</h2>
<?php
perch_content_custom('location-company-name', array(
'page'=>'/*',
'template'=>'text-break.html',
));
?><br />
</div>
<div class="col-md-4 col-xs-4">
<h2>Tel</h2>
<?php
perch_content_custom('location-tel', array(
'page'=>'/*',
'template'=>'text-break.html',
));
?><br />
Hi John
Do you mean that you added '<a>' and '<a/>' tags in the text boxes within Perch and it's outputting them as text themselves? If so, then I wouldn't put them in there at all. Instead, I would have your 'location-company-name' as a different template that wraps the HTML markup around the Perch tags. For example, your template could be:
Hope that makes sense.
Correct and just what I was looking for thanks, this worked great. I have a follow up question if I may?..
These regions from the other pages are feeding into my listings page and now have links on them.
I'm still creating these pages and they are showing on the listing page in the order that they are created. If i re-order pages in admin could/should this affect the sort order on the listing page?
hope you can help again, thnaks
The content from the pages isn't ordered by page. You'll need to specify
sort
andsort-order
options forperch_content_custom()
ah, thanks for pointing me in the right direction
Hi,
I'm having a bit of further difficulty now with sorting, hope you can help...
the pages i'm creating shows information on the listing page in three columns ( Location | Company Name | Telelphone Number)
I wanted to sort by company name alphabetically which worked, but of course the other details don't sort and don't adjust to match. I've also realised that resaving a page changes the order which would be a problem as the details don't line up.
Is there a way for a custome sort order? eg in the Location, Company Name and telephone regions of a particular page assign a number?
edit: think i can do it with a repeater region
The repeater region did work - i have been looking at this again and it would be nice to sort the information by the first column, is this possible.
This is the page with the listing https://www.dbtesting.co.uk/screenshot/Screenshot-2015-02-23-1.png
These are my pages - reordering doesn't make any difference to the page with the listing https://www.dbtesting.co.uk/screenshot/Screenshot-2015-02-23-2.png
this is the repeating region being pulled to the page with the listing https://www.dbtesting.co.uk/screenshot/Screenshot-2015-02-23-3.png
code in listing page..
You need to use the
sort
andsort-order
options to sort the output.they seem to kill it but i'll have another look if you say it's possible, thanks.
Sorry i'm still struggling. What should i use for 'sort' and 'sort-order' ? everything I try makes it blank. Here is my repeater content code...
Can you show us what code you've got in the page? The options should include something like:
it's as I mentioned before
This works. I can comment out
'template'=>'hyperlink-text-all.html',
and it still works. I thought that mattered so maybe it's set up wrong?
I have been trying different id's in the 'id_you_want_to_sort_by' part of sort => that look likely but all seem to break it.
Thanks
Please show me the full code that 'breaks' it.
Hi Drew. Sorry for delay, yes..
or..
or...
thanks
Do all your IDs have dashes in them?
Do all the items returned contain the field you're trying to sort on?
yes i've used dashes between words, they match what i'm putting in the sort field but could dashes be a problem?
based on my repeater region..
i thought the id should be 'hyperlink-text' ..
but i've been trying a few id's to no avail.
Dashes could be a problem, but it's hard to say. They're not permitted in IDs, but whether they're the actual cause here I don't conclusively know.