Hello Yongming,
I'm probably a little old fashioned on the debugging. But I open a file
and write to it.
$fh = fopen("/tmp/testing", "a");
fwrite($fh, "The value of locationstuff is: " . $locationstuff . "\n");
fwrite($fh, "The value of thislocation is: " . $thislocation . "\n");
If the variable is an array you need to run it through print_r
$tmp_var = print_r($holding, true);
fwrite($fh, "The value of holding is: " . $tmp_var . "\n");
al
On Fri, 2012-02-24 at 09:24 -0500, Yongming Wang wrote:
> Dear VuFind Community,
>
> Is there a way to print out the variable value in debugging mode? This is what I want to accomplish:
>
> I am trying to do what Julia Bauder did for her offline VuFind project. Specifically, I want to display the location from my MARC record's 996 field and call number from 050 field. I added the following codes to MarcRecord.php (totally borrow it from Julia Bauder - a big thank you to Julia!):
>
> public function getStatus($id)
> {
> $callnumber = parent::getcallnumber();
> if ($this->_getFirstFieldValue('090', array('a')) != NULL) {
> $parttwo = $this->_getFirstFieldValue('090', array('b'));
> $callnumber .= " " . $parttwo;
> }
> elseif ($this->_getFirstFieldValue('086', array('a')) != NULL) {
> $callnumber = $this->_getFirstFieldValue('086', array('a'));
> $parttwo = $this->_getFirstFieldValue('086', array('b'));
> $callnumber .= " " . $parttwo;
> }
> elseif ($this->_getFirstFieldValue('050', array('a')) != NULL) {
> $parttwo = $this->_getFirstFieldValue('050', array('b'));
> $callnumber .= " " . $parttwo;
> }
> $locationstuff = $this->marcRecord->getFields('996');
> $thislocation = $locationstuff[0]->getSubfields('b');
> foreach ($thislocation as $thislocationA) {
> $holding[] = array('availability' => 1,
> 'status' => 'Available',
> 'location' => $thislocationA->getData(),
> 'reserve' => 'No',
> 'callnumber' => $callnumber,
> 'duedate' => '',
> 'number' => 1);
> }
> return $holding;
> }
>
> And this is how my MARC record's 996 field looks like:
> 996 0 0 |b Stacks |h PS1331 .W3 1967 |a NJI |c library |n 8846 |m 8176
>
> I really want to see the values of $locationstuff and $thislocation on the screen when I click the title to go to the record page, because right now I got "translate_index_not_found(0)" error instead of "Stacks" as location on the record page. I suspect that those variables get the values from the MARC record.
>
> I added Stacks = "Stacks" to the end of lang/en.ini file but no use.
>
> How can I do that? or Can I do that?
>
>
> Thanks very much.
>
>
>
> Yongming
>
> ---------------------------------
> Yongming Wang
> Systems Librarian
> The College of New Jersey Library
> phone: 609-771-3337
> email: wangyo@...
> ---------------------------------
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> VuFind-General mailing list
> VuFind-General@...
> https://lists.sourceforge.net/lists/listinfo/vufind-general
--
Alan Rykhus
PALS, A Program of the Minnesota State Colleges and Universities
(507)389-1975
alan.rykhus@...
"It's hard to lead a cavalry charge if you think you look funny on a
horse" ~ Adlai Stevenson
|