Displaying more than one description subfield in the same URL link

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Displaying more than one description subfield in the same URL link

Wong, Philip

Hi,

 

We are trying to look for a way to display more than one description subfield from the URL. Example, if marc tag 856 contains $u, $z and $s

 

$uhttp://ourlibrary.ca/report.pdf    $zBudget of Government     $sPDF, size 50 MB

 

we want to display the link $u along with both the descriptions $z and $s.

 

Searching the listserv it appeared that it was easy to customize this in getURLs() (now in SolrDefault.php in 3.x). Looking at the source it does not look straight forward to add more than one description to the link. Any hints on this?  Is this configurable?  Displaying multiple description subfields from 856 is not uncommon.

 

Thank you.

 

Philip

--

Philip Wong

Systems Librarian

Legislative Library of British Columbia


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
VuFind-General mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/vufind-general
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Displaying more than one description subfield in the same URL link

Demian Katz

Philip,

 

I think a fairly minor change to the SolrMarc.php code should address your needs. Change this code:

 

                        foreach ($subfields as $current) {

                            $desc = $url->getSubfield($current);

                            if ($desc) {

                                break;

                            }

                        }

 

To something more like this:

 

                        $desc = '';

                        foreach ($subfields as $current) {

                            $desc = trim($desc . ' ' . $url->getSubfield($current));

                        }

 

…then modify the $fieldsToCheck value at the top to add the other subfields you would like to concatenate into the description.

 

If this works for you, it may make sense for us to add some configuration settings somewhere to allow the concatenation behavior and subfield lists to be addressed through an .ini file so this behavior can be adjusted without the need for code changes.

 

Let me know what you think!

 

- Demian

 

From: Wong, Philip [mailto:[hidden email]]
Sent: Tuesday, February 21, 2017 6:06 PM
To: [hidden email]
Cc: Wong, Philip
Subject: [VuFind-General] Displaying more than one description subfield in the same URL link

 

Hi,

 

We are trying to look for a way to display more than one description subfield from the URL. Example, if marc tag 856 contains $u, $z and $s

 

$uhttp://ourlibrary.ca/report.pdf    $zBudget of Government     $sPDF, size 50 MB

 

we want to display the link $u along with both the descriptions $z and $s.

 

Searching the listserv it appeared that it was easy to customize this in getURLs() (now in SolrDefault.php in 3.x). Looking at the source it does not look straight forward to add more than one description to the link. Any hints on this?  Is this configurable?  Displaying multiple description subfields from 856 is not uncommon.

 

Thank you.

 

Philip

--

Philip Wong

Systems Librarian

Legislative Library of British Columbia


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
VuFind-General mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/vufind-general
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Displaying more than one description subfield in the same URL link

Wong, Philip
In reply to this post by Wong, Philip

Hi Demian,

 

That worked!  With a little twist, I added a variable in the loop to get the data first

 

$desc = '';

foreach ($subfields as $current) {

   $desctmp = $url->getSubfield($current);

    if ($desctmp)

        $desc = trim($desc . ' ' . $desctmp->getData());                                            

}

 

and comment out the last getData()

 

if ($desc) {

    // $desc = $desc->getData();

 

Thanks a lot!

Philip

 

From: Demian Katz [mailto:[hidden email]]
Sent: Wednesday, February 22, 2017 5:41 AM
To: Wong, Philip <[hidden email]>; [hidden email]
Subject: RE: [VuFind-General] Displaying more than one description subfield in the same URL link

 

Philip,

 

I think a fairly minor change to the SolrMarc.php code should address your needs. Change this code:

 

                        foreach ($subfields as $current) {

                            $desc = $url->getSubfield($current);

                            if ($desc) {

                                break;

                            }

                        }

 

To something more like this:

 

                        $desc = '';

                        foreach ($subfields as $current) {

                            $desc = trim($desc . ' ' . $url->getSubfield($current));

                        }

 

…then modify the $fieldsToCheck value at the top to add the other subfields you would like to concatenate into the description.

 

If this works for you, it may make sense for us to add some configuration settings somewhere to allow the concatenation behavior and subfield lists to be addressed through an .ini file so this behavior can be adjusted without the need for code changes.

 

Let me know what you think!

 

- Demian

 

From: Wong, Philip [[hidden email]]
Sent: Tuesday, February 21, 2017 6:06 PM
To: [hidden email]
Cc: Wong, Philip
Subject: [VuFind-General] Displaying more than one description subfield in the same URL link

 

Hi,

 

We are trying to look for a way to display more than one description subfield from the URL. Example, if marc tag 856 contains $u, $z and $s

 

$uhttp://ourlibrary.ca/report.pdf    $zBudget of Government     $sPDF, size 50 MB

 

we want to display the link $u along with both the descriptions $z and $s.

 

Searching the listserv it appeared that it was easy to customize this in getURLs() (now in SolrDefault.php in 3.x). Looking at the source it does not look straight forward to add more than one description to the link. Any hints on this?  Is this configurable?  Displaying multiple description subfields from 856 is not uncommon.

 

Thank you.

 

Philip

--

Philip Wong

Systems Librarian

Legislative Library of British Columbia


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
VuFind-General mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/vufind-general
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Displaying more than one description subfield in the same URL link

Demian Katz

Ahh, yes, sorry for missing that important detail – but glad it worked out for you!

 

- Demian

 

From: Wong, Philip [mailto:[hidden email]]
Sent: Wednesday, February 22, 2017 12:35 PM
To: Demian Katz; [hidden email]
Cc: Wong, Philip
Subject: RE: [VuFind-General] Displaying more than one description subfield in the same URL link

 

Hi Demian,

 

That worked!  With a little twist, I added a variable in the loop to get the data first

 

$desc = '';

foreach ($subfields as $current) {

   $desctmp = $url->getSubfield($current);

    if ($desctmp)

        $desc = trim($desc . ' ' . $desctmp->getData());                                            

}

 

and comment out the last getData()

 

if ($desc) {

    // $desc = $desc->getData();

 

Thanks a lot!

Philip

 

From: Demian Katz [[hidden email]]
Sent: Wednesday, February 22, 2017 5:41 AM
To: Wong, Philip <[hidden email]>; [hidden email]
Subject: RE: [VuFind-General] Displaying more than one description subfield in the same URL link

 

Philip,

 

I think a fairly minor change to the SolrMarc.php code should address your needs. Change this code:

 

                        foreach ($subfields as $current) {

                            $desc = $url->getSubfield($current);

                            if ($desc) {

                                break;

                            }

                        }

 

To something more like this:

 

                        $desc = '';

                        foreach ($subfields as $current) {

                            $desc = trim($desc . ' ' . $url->getSubfield($current));

                        }

 

…then modify the $fieldsToCheck value at the top to add the other subfields you would like to concatenate into the description.

 

If this works for you, it may make sense for us to add some configuration settings somewhere to allow the concatenation behavior and subfield lists to be addressed through an .ini file so this behavior can be adjusted without the need for code changes.

 

Let me know what you think!

 

- Demian

 

From: Wong, Philip [[hidden email]]
Sent: Tuesday, February 21, 2017 6:06 PM
To: [hidden email]
Cc: Wong, Philip
Subject: [VuFind-General] Displaying more than one description subfield in the same URL link

 

Hi,

 

We are trying to look for a way to display more than one description subfield from the URL. Example, if marc tag 856 contains $u, $z and $s

 

$uhttp://ourlibrary.ca/report.pdf    $zBudget of Government     $sPDF, size 50 MB

 

we want to display the link $u along with both the descriptions $z and $s.

 

Searching the listserv it appeared that it was easy to customize this in getURLs() (now in SolrDefault.php in 3.x). Looking at the source it does not look straight forward to add more than one description to the link. Any hints on this?  Is this configurable?  Displaying multiple description subfields from 856 is not uncommon.

 

Thank you.

 

Philip

--

Philip Wong

Systems Librarian

Legislative Library of British Columbia


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
VuFind-General mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/vufind-general
Loading...