Post by Joe1234 » Thu Jul 07, 2022 12:48 pm

I have a code that's dependent on an extension, could someone provide me with the "if" line of code condition that I would put around the code to test for this extension? Let's say the extension's name is "Joe1234".

v3.0.3.9 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.


Active Member

Posts

Joined
Sat Jan 01, 2022 5:47 am

Post by halfhope » Fri Jul 08, 2022 3:08 pm

Hi!

I recommend you make a subdomain for testing all extensions/modifications. Or you can set a developer cookie that contains some password and check them in your controller.

1. Set cookie "dev=bae4csd'. You can use DevTools->Application->Cookie
2. Put cookie in data array

Code: Select all

$data['is_dev'] = ((isset($this->request->cookie['dev']) && $this->request->cookie['dev'] == 'bae4csd') ? true : false);
3. Check is_dev

Code: Select all

{% if (is_dev) %}
//your code
{% endif %}

My extensions in marketplace. [ security | flexibility | speedup ]


User avatar
Active Member

Posts

Joined
Tue Dec 10, 2013 9:44 pm
Location - San Diego

Post by Joe1234 » Sat Jul 09, 2022 1:11 am

Thanks for that, good idea. For some reason I just couldn't get it to work with true/false, so I'm testing for the cookie and the value instead:

Code: Select all

setcookie("PBS", "1", time() + (86400 * 30), "/");

;=========================================================================;

if (isset($this->request->cookie['PBS']) && $this->request->cookie['PBS'] == "1") {
}
...or will this cause an unforeseen issue somehow?

v3.0.3.9 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.


Active Member

Posts

Joined
Sat Jan 01, 2022 5:47 am
Who is online

Users browsing this forum: Bing [Bot], Semrush [Bot] and 263 guests