well to give you a suggestion I need to know what your doing where.
Are you using this code in the gallery only meaning this is a standalone or non vb
install or is this a vb
install where your placing code in vbulletin?
There is a huge syntax difference between the two.