Thread Rating:
  • 3 Vote(s) - 3.67 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Links Manager (was Link Manager 2)
#44
(2015-06-05, 19:50:10)morvy Wrote: Hi guys,

can you help this poor coder <!-- me --> to find a way how to print array of links from category without html stuff ? I use this plugin a lot for many different things (slideshows, footer menus, intropage boxes etc) and creating own parsers for html with regexes or asXml structures is a pain .. :/ I looked at the code but my object programming skill is stuck somewhere in year 1900 Big Grin

Thanks for help !

As far as the introductory post in this thread is confirmed, it seems impossible to return the raw data for the links, eg in a PHP array, and without the HTML? If this is (sadly) so, and the link is set on the href property in the return gotten with return_links, you could do something like this:

PHP Code:
<?php $links_html return_links(categoryId);
  
$captureHREFS '~(href=["\'])(.*?)(["\'])~';
  
preg_match_all($captureHREFS$links_html$links_dataPREG_PATTERN_ORDER);
  
$links_data $links_data[2];
  
  
// Now you can loop over the links & provide custom output
  
foreach ($links_data as $link) {
    echo 
'<span>Unconventional link template! ' $link '</span>';
  } 

Disclaimer: this hasn't been extensively tested.

NB to mrdragonraaar : I saw in the introductory thread that the 'echo parameter had been dropped in favour of a new return function'. IMHO return_anything should return the raw data associated with the data entity, because you never know whether the user agrees with the default output you choose. And you don't have to sacrifice the feature of returning the output & preprocessing it. EG, in GS Custom Settings if you want to get image data, you can do:
- return_setting('tab', 'image_field') which will return only the URL
- get_setting('tab', 'image_field') which will output an image tag
- get_setting('tab', 'image_field', false) which will return the image tag output.

Similarly (and to avoid needless regex replacements), you could have:
- return_links($catId) which would return an array of URLS
- get_links($catId) which would output a list of URLS, eventually with the option of using a component
- get_links($catId, false) which would return the default list output for preprocessing
Reply


Messages In This Thread
RE: Link Manager 2 - by bhwebco - 2012-12-06, 04:39:22
RE: Link Manager 2 - by grassfrog - 2012-12-30, 18:17:55
RE: Link Manager 2 - by grassfrog - 2013-01-05, 07:45:33
RE: Link Manager 2 - by mtw - 2013-02-06, 21:03:08
RE: Link Manager 2 - by datiswous - 2013-02-21, 08:14:14
RE: Link Manager 2 - by mtw - 2013-06-28, 08:11:16
RE: Link Manager 2 - by datiswous - 2013-06-29, 09:37:07
RE: Link Manager 2 - by datiswous - 2013-02-22, 10:17:35
RE: Link Manager 2 - by mtw - 2013-06-30, 15:42:34
RE: Link Manager 2 - by mrdragonraaar - 2013-09-21, 07:34:21
RE: Link Manager 2 - by mrdragonraaar - 2013-09-22, 23:15:19
RE: Link Manager 2 - by datiswous - 2013-09-23, 11:13:36
RE: Link Manager 2 - by mrdragonraaar - 2013-09-23, 14:35:28
RE: Link Manager 2 - by datiswous - 2013-09-24, 09:45:19
RE: Link Manager 2 - by mrdragonraaar - 2013-09-24, 19:53:46
RE: Link Manager 2 - by mrdragonraaar - 2013-09-24, 08:36:11
RE: Link Manager 2 - by mrdragonraaar - 2013-09-25, 12:27:43
RE: Link Manager 2 - by datiswous - 2013-09-27, 04:50:23
RE: Link Manager 2 - by mrdragonraaar - 2013-09-30, 10:21:28
RE: Links Manager (was Link Manager 2) - by mtw - 2013-11-23, 19:37:30
RE: Links Manager (was Link Manager 2) - by Rene - 2013-11-30, 00:27:34
RE: Links Manager (was Link Manager 2) - by morvy - 2015-06-05, 19:50:10
RE: Links Manager (was Link Manager 2) - by Tyblitz - 2015-06-09, 08:06:44
RE: Links Manager (was Link Manager 2) - by morvy - 2015-06-10, 08:28:46
RE: Links Manager (was Link Manager 2) - by morvy - 2015-06-10, 20:04:38
RE: Links Manager (was Link Manager 2) - by morvy - 2015-06-16, 03:59:12
RE: Links Manager (was Link Manager 2) - by morvy - 2015-06-19, 01:21:37
RE: Links Manager (was Link Manager 2) - by morvy - 2015-08-11, 20:31:40
RE: Links Manager (was Link Manager 2) - by morvy - 2015-08-12, 11:46:32
RE: Links Manager (was Link Manager 2) - by morvy - 2015-09-18, 10:23:01
Link Manager 2 - by Carlos - 2012-10-29, 07:10:45
Link Manager 2 - by Carlos - 2012-10-29, 07:29:40
Link Manager 2 - by mrdragonraaar - 2012-10-29, 10:05:06
Link Manager 2 - by mrdragonraaar - 2012-10-29, 10:11:11
Link Manager 2 - by mrdragonraaar - 2012-10-29, 11:29:05
Link Manager 2 - by Carlos - 2012-10-30, 01:35:52
RE: Link Manager 2 - by mrdragonraaar - 2012-10-30, 09:34:47
RE: Link Manager 2 - by mrdragonraaar - 2012-11-03, 09:50:35



Users browsing this thread: 1 Guest(s)