Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

Need to print this field

Links for php scripts

Moderators: macek, egami, gesf

Need to print this field

Postby Hanscraft » Mon Jan 02, 2012 1:30 pm

The original coder for this website created a field called Item description (itemdesc) which he called/declared into the tpl.php template using this:
Code: Select all
<?php
$bnum_arr = $node->field_itembnum;
$desc_arr = $node->field_itemdesc;
?>


Further down the page he called in itembnum with this:
Code: Select all
<?php
if ($page != 0) {
   print DL_functions_booklist_show_item($bnum_arr);
?>


I checked the function and found the code that called in the items required of that field. However, I cannot for the life of me figure out what the PHP code would be to call in the $desc_arr. The published page which features this code can have several of these blocks ($bnum_arr and $desc_arr), so I need to make sure that the resulting PHP code will print like so:

Item number
Item description

Item number
Item description

Previous attempts have resulted with all the Item number fields printing together and then the Item description fields attached to the very bottom of the Item number list. I'd really appreciate some insight since I'm completely stuck!
Hanscraft
New php-forum User
New php-forum User
 
Posts: 4
Joined: Mon Jan 02, 2012 1:13 pm

Re: Need to print this field

Postby presschimp » Tue Mar 27, 2012 4:15 am

for the print for the field we have to use echo command and the code inserted in this field.

cheap printing
presschimp
New php-forum User
New php-forum User
 
Posts: 1
Joined: Tue Mar 27, 2012 4:06 am

Re: Need to print this field

Postby landi » Tue Mar 27, 2012 1:45 pm

Hi,
It looks like the function DL_functions_booklist_show_item() prints the list, right?

If so, then you need to modify that function to print the descriptino right after the item number, and you will probably need to pass $desc_arr to the fuctino as a second argument e.g.:

Code: Select all
print DL_functions_booklist_show_item($bnum_arr, $desc_arr);


If this doesn't solve the problem, then please post the code for DL_functions_booklist_show_item() - assuming it isn't massive.

-A
landi
New php-forum User
New php-forum User
 
Posts: 242
Joined: Thu Mar 15, 2012 3:59 pm


Return to PHP Scripts

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron