Hi guys, more for a learning experience and possibly code speed-up as a secondary benefit, I was curious if there might be a better way to handle these two lines of code using "replacelist". I've been reading in other threads where replace has been sped up but replacelist isn't as fast as RegExReplace at least for dealing huge list (which is not the case here). In these 2 lines below, the first is using the thumbnail size selected "$T_size_sel" and relating it to the 5 different thumbnail sizes and getting the corresponding "view" cid (e.g., 308) which will be variable "$thumb_cid". The second line is using an "if" condition along with another "replacelist" simply obtaining the current view and relating it to the different views to obtain the proper corresponding cid, to get into that view (only) if not already. The end result is to get into the "view" based on the selected thumbnail size. I've been studying examples of using regexreplace both here and on other sites, but I'm having no luck. It works fine, but I was wondering if there might be a streamlined or RegExReplace method ?
Code: Select all
$thumb_cid = replacelist($T_size_sel, "$T_sm|$T_med|$T_lg|48x48|64x64", "306|307|308|313|314","|");
if(replacelist(get("View"), "4|5|6|8|9", "306|307|308|313|314","|") != $thumb_cid) {#$thumb_cid;}
Thanks,
Ken