Jump to content

array spliting


cmb

Recommended Posts

right now my array is set up so the title of the picture (which is a number) is the key and the keyword or words associated with that picture are the values separated by commas:

Array(
    [1.jpg] => Tyler
    [10.jpg] => Callum
    [11.jpg] => Callum
    [12.jpg] => Adam
    [13.jpg] => Justin
    [14.jpg] => Shane
    [15.jpg] => Callum,Grant
    [16.jpg] => Justin
    [17.jpg] => Justin
    [18.jpg] => Austin
    [19.jpg] => Jarod
    [2.jpg] => Tyler
    [20.jpg] => Austin
    [21.jpg] => Tyler
    [22.jpg] => Justin
    [23.jpg] => Tyler
    [24.jpg] => Jarod
    [3.jpg] => Callum
    [4.jpg] => Shane,Callum
    [5.jpg] => Adin
    [6.jpg] => Justin
    [7.jpg] => Callum
    [8.jpg] => Adam
    [9.jpg] => Callum
    [25.jpg] => Jarod
)

im using the galleriffic jquery photo album and in the description area for the picture it shows the keywords in a hyperlink to another page were it shows all the pictures with that keyword but what i want is for when their are multiple keywords i want them to show up as separate hyperlinks

Link to comment
Share on other sites

You can't. Array keys must be unique therefore you can only have one 15.jpg. What I suggest you do is have a multidimensional array.

 

[1.jpg] => array([0] => "Callum", [1] => "Grant")
[2.jpg] => array([0] => "Something", [1] => "Else", [2] => "Here")

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.