These are chat archives for collectiveaccess/support

Dec 2017
Dec 29 2017 01:00
@sshipley64 Thank you
Dec 29 2017 01:24
I used ^ so that it can display date range. Though single date will be displayed as 2017-2017, but I can export the result and modify in excel. You saved my life!
Dec 29 2017 09:50
@mwbenowitz Thank you so much! just learned a whole lot about PHP. My definitively whacky and hacky solution works fine! If anybody wnats to improve this cumbersome code be my guest 😊
  // get metadata element lcsh_terms with structure as array
  $lcshterms = $t_object->get("ca_objects.lcsh_terms", array('returnWithStructure' => true));
    // iterate over nested arrays
    foreach ($lcshterms AS $ebene1) {
      foreach ($ebene1 AS $ebene2) {
        //get string
        $str = $ebene2['lcsh_terms'];
        // regex string to get term only
        $rename = '/(.+?)\[.*/m';
        $substname = '$1';
        $name = preg_replace($rename, $substname, $str);
        // regex string to get id only
        $reurl = '/(.+?)\[(.*)(\])/m';
        $substurl = '$2';
        $rawurl = preg_replace($reurl, $substurl, $str);
        // str_replace id to get URL
        $url = str_replace('info:lc', '', $rawurl);
        // output name as link to URL:
        echo "<li><a href=\"".$url. "\" target=\"_blank\">".$name. "</a>";