inherit
217348
0
Jul 27, 2022 7:26:44 GMT -8
Lynx
5,846
January 2015
msg
|
Post by Lynx on Dec 14, 2020 16:47:47 GMT -8
LynxDoes that if statement require a "for/loop"? Nope. Just use elseif to test other conditionals: if ((pb.data('route').params.page_id == "PAGE_ID_1") && (pb.plugin.get('my_plugin').settings.video_url)) { // code to run if we're on PAGE_ID_1 AND we have a video_url filled out } elseif ((pb.data('route').params.page_id == "PAGE_ID_2") && (pb.plugin.get('my_plugin').settings.audio_url)) { // code to run if we're on PAGE_ID_2 AND we have an audio_url filled out } // more elseif's can be placed here for other combinations else { // code to run if none of the above conditionals are met }
|
|
inherit
169267
0
Member is Online
Nov 23, 2024 18:59:51 GMT -8
Mike
Praise God Almighty!
1,534
July 2011
riccetts
|
Post by Mike on Dec 15, 2020 5:28:54 GMT -8
|
|
inherit
169267
0
Member is Online
Nov 23, 2024 18:59:51 GMT -8
Mike
Praise God Almighty!
1,534
July 2011
riccetts
|
Post by Mike on Dec 16, 2020 10:02:35 GMT -8
LynxI really want those plugins separate from each other. Can I use just: if ((pb.data('route').params.page_id == "page") && (pb.plugin.get('new_video_caddy').settings.url)) { for each plugin. Now is there a way to pre direct it to that page? without the forum search. Like saying .page_id=="featured" automatically placing it on that page. I did experiment with your code but I'm not sure where to place it in the plugin code. It hasn't worked at all yet.
|
|
inherit
217348
0
Jul 27, 2022 7:26:44 GMT -8
Lynx
5,846
January 2015
msg
|
Post by Lynx on Dec 18, 2020 16:56:36 GMT -8
Mike, Yes, each plugin can use that line, but "page" must be different page ID's if they are going to affect different pages. If you mean redirecting to a page by "pre direct to a page", no - not without a user action. Automatic redirects are a no-no. I'd suggest adding links to your navbar to take the user to a particular page. If you follow the example above, then it'll get placed on that page if the conditional is true. In other words, we are on PAGE_ID_1 AND we have a video URL. If either, or both, of those are false, the AND returns false - so the video won't get placed on that page. If we were on PAGE_ID_2 (where we want the audio URL), then the conditional checking to see if we were on PAGE_ID_1 would return false - so the audio would not get placed on PAGE_ID_1, because we're on the wrong page. I would need to see your entire code to know about placement. You can PM it to me if you don't want to post it. - Sorry for the late reply - I don't log on every day.
|
|
inherit
169267
0
Member is Online
Nov 23, 2024 18:59:51 GMT -8
Mike
Praise God Almighty!
1,534
July 2011
riccetts
|
Post by Mike on Dec 22, 2020 11:43:23 GMT -8
LynxThanks for your help I managed to have both plugins work without a conflict
|
|
inherit
217348
0
Jul 27, 2022 7:26:44 GMT -8
Lynx
5,846
January 2015
msg
|
Post by Lynx on Dec 23, 2020 8:57:39 GMT -8
LynxThanks for your help I managed to have both plugins work without a conflict Glad you got it working!
|
|