Panels UI: Using a pvar to change a button's function?, Is this possible? |
![]() ![]() |
Panels UI: Using a pvar to change a button's function?, Is this possible? |
Mar 20 2008, 00:48
Post
#1
|
|
|
Group: Members Posts: 653 Joined: 1-May 06 From: Canada Member No.: 30281 |
Hello,
I am trying to use a pvar switch to have a button do different things depending on the pvar number. Here is what I am trying, but it just isn't working: CODE $button2(35,17,0,0,208,16, '%artist%', '%artist%', $ifequal($getpvar(artist_link),1, EXEC:http'://'en.wikipedia.org/wiki/$replace(%artist%, ,_) , $ifequal($getpvar(artist_link),2, EXEC:http'://'www.youtube.com/results.php?search_query=$replace(%artist%, ,+) ),) , TOOLTIP:"Search Wikipedia For: %artist%") I may have the code incorrent, but with all the ) and ( and , it can get confusing. Anyways, what I am trying to accomplish is if the pvar "artist_link" is set to 1, then the Wikipedia page loads, otherwise if it is set to 2, the YouTube page loads. I am going to repeat this for 6 sites in total. Does anyone know how to accomplish this? Thank you -------------------- Song List: keikoniumboards.ke.funpic.org/files/songlist.html
|
|
|
|
Mar 20 2008, 01:07
Post
#2
|
|
|
Group: Members Posts: 473 Joined: 25-June 05 Member No.: 22962 |
You have an extra comma, but you can use $select to simplify the job:
CODE $button2(35,17,0,0,208,16,
'%artist%', '%artist%', $select($getpvar(artist_link), //1 EXEC:http'://'en.wikipedia.org/wiki/$replace(%artist%, ,_), //2 EXEC:http'://'www.youtube.com/results.php?search_query=$replace(%artist%, ,+), //3 , //4 etc ), TOOLTIP:"Search Wikipedia For: %artist%") |
|
|
|
Mar 20 2008, 01:08
Post
#3
|
|
|
Group: Members Posts: 653 Joined: 1-May 06 From: Canada Member No.: 30281 |
Ah even better! Thank you Purple Monkey
-------------------- Song List: keikoniumboards.ke.funpic.org/files/songlist.html
|
|
|
|
Mar 20 2008, 22:50
Post
#4
|
|
![]() Group: Members Posts: 1535 Joined: 8-May 06 Member No.: 30546 |
CODE $select($getpvar(artist_link), //1 EXEC:http'://'en.wikipedia.org/wiki/$replace(%artist%, ,_), //2 EXEC:http'://'www.youtube.com/results.php?search_query=$replace(%artist%, ,+), //3 , //4 etc ) One thing to keep in mind is that by default the pvar will not have a value and will evaluate as 0 until you set it (I presume you are using an external function somewhere). So you may want to consider using CODE $select($add($getpvar(artist_link),1), ... ) This way the routine will always perform a function even if the pvar gets unset or zeroed. EDIT: You would also need to adjust the external function setting the pvar to 1 integer lower. This post has been edited by Yotsuya: Mar 20 2008, 22:53 -------------------- http://www.ubuntu.com
|
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 26th May 2013 - 09:28 |