Customizing SMF > SMF Coding Discussion

Arrary issue

(1/1)

The Wizard:
The array code below will show up a image of a picture, or a image of a blue space image. I would like only the images to show up and not the blue space image. I know there there is a way to configure the error code so if there is no data it will ignore everything after, but I don't know how to code this. I have try-ed and I expect it's something easy for allot of users, but I'm still learning and I learn by seeing examples. So if you can show me the right code it would help me out alot.

Thanks

Wiz



--- Code: --- 'wizard_images' => array(
                   'wizard1' => empty($profile['wizard1']) ? '<img src="' . $boardurl . '/Sources/shop/wizards_item_image_gallery/small/space.png' . '">' : '<a href="' . $boardurl . '/Sources/shop/wizards_item_image_gallery/big/' . $profile['wizard1'] . 'a.png' . '" target="_blank"><img src="' . $boardurl . '/Sources/shop/wizards_item_image_gallery/small/' . $profile['wizard1'] . '.png' . '"></a>',
                       'wizard2' => empty($profile['wizard2']) ? '<img src="' . $boardurl . '/Sources/shop/wizards_item_image_gallery/small/space.png' . '">' : '<a href="' . $boardurl . '/Sources/shop/wizards_item_image_gallery/big/' . $profile['wizard2'] . 'a.png' . '" target="_blank"><img src="' . $boardurl . '/Sources/shop/wizards_item_image_gallery/small/' . $profile['wizard2'] . '.png' . '"></a>',
                   'wizard3' => empty($profile['wizard3']) ? '<img src="' . $boardurl . '/Sources/shop/wizards_item_image_gallery/small/space.png' . '">' : '<a href="' . $boardurl . '/Sources/shop/wizards_item_image_gallery/big/' . $profile['wizard3'] . 'a.png' . '" target="_blank"><img src="' . $boardurl . '/Sources/shop/wizards_item_image_gallery/small/' . $profile['wizard3'] . '.png' . '"></a>',
)
--- End code ---
                         

emanuele:
Replace the code of the blue space image with two single quotes.
Something like:

--- Code: --- 'wizard_images' => array(
                   'wizard1' => empty($profile['wizard1']) ? '' : '<a href="' . $boardurl . '/Sources/shop/wizards_item_image_gallery/big/' . $profile['wizard1'] . 'a.png' . '" target="_blank"><img src="' . $boardurl . '/Sources/shop/wizards_item_image_gallery/small/' . $profile['wizard1'] . '.png' . '"></a>',
--- End code ---

BTW, you should have images in the themes directory, not in the Sources.

The Wizard:
Quick Question - What does the two quotes mean? Like a space or empty field?

emanuele:
An empty string.

Navigation

[0] Message Index

Go to full version