MarkE Posted May 20, 2020 Share Posted May 20, 2020 Thanks - that looks neat. I guess I could then just have another function for the common elements. Link to comment Share on other sites More sharing options...
Pixrael Posted May 21, 2020 Share Posted May 21, 2020 2 hours ago, MarkE said: Thanks - that looks neat. I guess I could then just have another function for the common elements. Check this: https://github.com/blynx/TextformatterFunkyFunctions Link to comment Share on other sites More sharing options...
MarkE Posted May 21, 2020 Share Posted May 21, 2020 8 hours ago, Pixrael said: Check this: https://github.com/blynx/TextformatterFunkyFunctions Thanks. That’s useful, in that it has no database component, but I really need a drop-down/dialog capability so I think I’ll have to stick with the “hybrid” route, where only standard code is in the back-end. Link to comment Share on other sites More sharing options...
MarkE Posted August 10, 2020 Share Posted August 10, 2020 All my hanna codes return $hanna->field as: id => 0 name => "" label => "" flags => "" type => null Any ideas why? The other properties ($hanna->name and $hanna->value) are fine (contents shown are from Tracy - bd($hanna)) Solved - just being a bit dim and not realising that I need to pass the field explicitly in the API - it doesn't infer it from the context. Link to comment Share on other sites More sharing options...
Dzung Posted September 1, 2020 Share Posted September 1, 2020 Hi, I am using PW 3.0.165, I installed Hanacode Module but error pop pup "Excuse me… Compile Error: Cannot declare class FieldtypeRepeater, because the name is already in use (line 31 of site/modules/Fieldtype/FieldtypeRepeater/FieldtypeRepeater.module)". My web can not view anymore. Please help me. Thank you. Dzung Link to comment Share on other sites More sharing options...
flydev Posted September 1, 2020 Share Posted September 1, 2020 Hi, first of all, make a backup of everything. About the issue, it look like you have 2 modules file for the Fieldtype Repeater. One in wire/modules and another one in site/modules. Did you modified intentionally the module and made a copy of it in your site/module dir ? If yes, then do a Modules > Refresh then select the right Repeater module you want. If NOT, then rename the site/modules/Fieldtype/FieldtypeRepeater/ to site/modules/Fieldtype/.FieldtypeRepeater/ (note the dot before the module name) and do a Modules > Refresh. (it's quite strange, maybe a bad upload moment from you.) 1 Link to comment Share on other sites More sharing options...
kongondo Posted September 1, 2020 Share Posted September 1, 2020 15 minutes ago, flydev ?? said: it look like you have 2 modules file for the Not to hijack this thread, but recently I experienced something like this. ProcessWire said I had two identical modules but I didn't! A couple of refreshes sorted it out, so I didn't investigate it further. 1 Link to comment Share on other sites More sharing options...
Dzung Posted September 3, 2020 Share Posted September 3, 2020 On 9/1/2020 at 8:17 PM, flydev ?? said: Hi, first of all, make a backup of everything. About the issue, it look like you have 2 modules file for the Fieldtype Repeater. One in wire/modules and another one in site/modules. Did you modified intentionally the module and made a copy of it in your site/module dir ? If yes, then do a Modules > Refresh then select the right Repeater module you want. If NOT, then rename the site/modules/Fieldtype/FieldtypeRepeater/ to site/modules/Fieldtype/.FieldtypeRepeater/ (note the dot before the module name) and do a Modules > Refresh. (it's quite strange, maybe a bad upload moment from you.) == Hi FlyDev, Thank you for your reply. I had just installed what PW modules have, I do not create myself. Dzung Link to comment Share on other sites More sharing options...
Dzung Posted September 3, 2020 Share Posted September 3, 2020 On 9/1/2020 at 8:34 PM, kongondo said: Not to hijack this thread, but recently I experienced something like this. ProcessWire said I had two identical modules but I didn't! A couple of refreshes sorted it out, so I didn't investigate it further. Hi Kongondo, Thank you for your reply. My web is in full error, I have no chance to refresh it. Dzung Link to comment Share on other sites More sharing options...
Dzung Posted September 3, 2020 Share Posted September 3, 2020 Hi, I clear all tables in database, then import my backup, the site works again. Then I deleted Hanacode module in module directory, then I push Refesh in module control panel, the system error again. I push Refresh first time "ModulesDuplicates: There appear to be multiple copies of module "PagePathHistory" on the file system. Please edit the module settings to tell ProcessWire which one to use: PagePathHistory ", The second time, the site totally down! Dzung Link to comment Share on other sites More sharing options...
kongondo Posted September 3, 2020 Share Posted September 3, 2020 (edited) Hi @Dzung, What is your environment so we can try and replicate (MySQL and PHP). Are there any other errors in the error logs? I am very curious about this. In addition, with respect to one of my commercial modules, a user has reported a duplicate entry MySQL error when they try to install the module. Not quite the same as your case, but a duplicate all the same. I am waiting to find out their server environment. Edited September 3, 2020 by kongondo Link to comment Share on other sites More sharing options...
Dzung Posted September 4, 2020 Share Posted September 4, 2020 18 hours ago, kongondo said: Hi @Dzung, What is your environment so we can try and replicate (MySQL and PHP). Are there any other errors in the error logs? I am very curious about this. In addition, with respect to one of my commercial modules, a user has reported a duplicate entry MySQL error when they try to install the module. Not quite the same as your case, but a duplicate all the same. I am waiting to find out their server environment. Hi Kongodo, 1): OS: centos7 PHP version: 7.3.10 MySQL version: 10.1.45-MariaDB CWP version: 0.9.8.1006 Apache version: Apache/2.4.39 2). No, there is only FieldtypeRepeater duplicated error. Dzung Link to comment Share on other sites More sharing options...
Dzung Posted September 4, 2020 Share Posted September 4, 2020 Further, I tried it with Wamp on destop PC, it caused same problem, I can not install any module more. Dzung Link to comment Share on other sites More sharing options...
Dzung Posted September 4, 2020 Share Posted September 4, 2020 Hi @kongondo I see the list of errors attached file. Dzung Error-list.txt Link to comment Share on other sites More sharing options...
kongondo Posted September 4, 2020 Share Posted September 4, 2020 56 minutes ago, Dzung said: see the list of errors attached file. This is getting weirder! 1 hour ago, Dzung said: Further, I tried it with Wamp on destop PC, it caused same problem, Was this a fresh/completely new install? I.e. you didn't import your backup database? If you did import your backup, have you tried with a completely fresh install? Do you still get errors? I am unsure about the steps to reproduce, could you please list them? I.e., Install ProcessWire No errror Install Hanna Code Error? If you get no errors with a fresh database, then your database is probably corrupted. If you get errors with a fresh database/install, then I'd like to try and reproduce that. Thanks for debugging! Link to comment Share on other sites More sharing options...
Dzung Posted September 5, 2020 Share Posted September 5, 2020 On 9/4/2020 at 11:50 AM, kongondo said: This is getting weirder! Was this a fresh/completely new install? I.e. you didn't import your backup database? If you did import your backup, have you tried with a completely fresh install? Do you still get errors? I am unsure about the steps to reproduce, could you please list them? I.e., Install ProcessWire No errror Install Hanna Code Error? If you get no errors with a fresh database, then your database is probably corrupted. If you get errors with a fresh database/install, then I'd like to try and reproduce that. Thanks for debugging! Hi @kongondo, Many thanks for your efforts. My database had problems. I create brand new all, everything works fine! Dzung 1 Link to comment Share on other sites More sharing options...
kongondo Posted September 5, 2020 Share Posted September 5, 2020 1 hour ago, Dzung said: My database had problems. I had a feeling this was the issue. 1 hour ago, Dzung said: I create brand new all, everything works fine! Excellent! Glad you got it sorted! ? Link to comment Share on other sites More sharing options...
Mikie Posted September 29, 2020 Share Posted September 29, 2020 Hi apologies if I have missed this previously. Can hannacode work from the api? Specifically I am trying to render email body templates from pages via a cli script, and need access to the page data. Link to comment Share on other sites More sharing options...
kongondo Posted September 29, 2020 Share Posted September 29, 2020 37 minutes ago, Mikie said: Hi apologies if I have missed this previously. Can hannacode work from the api? Specifically I am trying to render email body templates from pages via a cli script, and need access to the page data. Like this? https://github.com/ryancramerdesign/ProcessHannaCode#using-hanna-code-from-the-api Link to comment Share on other sites More sharing options...
Mikie Posted September 29, 2020 Share Posted September 29, 2020 Thanks @kongondo I saw that... when I try that from a script that is bootstrapping processwire the $page variable is not available in the Hanna code snippet. Eg when visiting "test.php" in site root in the browser the below setup results in "Title: 404 not found', the $page variable populated to the Hanna snippet appears to be the 404 resulting from visiting test.php. "body" field content on page /path/to/page/ [[title]] /site/assets/cache/HannaCode/title.php <?php $title = $page->title; echo "Title: $title"; /test.php <?php include "./index.php"; $hanna = wire("modules")->get('TextformatterHannaCode'); $p = wire("pages")->get("/path/to/page/"); echo $hanna->render($p->body); Link to comment Share on other sites More sharing options...
Mikie Posted September 30, 2020 Share Posted September 30, 2020 Just writing all that out made me wonder if render accepts more arguments, which it does: https://github.com/ryancramerdesign/ProcessHannaCode/blob/5801578889bad3786e951427e64f3bc2146d3ba4/TextformatterHannaCode.module#L230 Passing $p from example above as second argument works: echo $hanna->render($p->body, $p); Link to comment Share on other sites More sharing options...
kongondo Posted September 30, 2020 Share Posted September 30, 2020 29 minutes ago, Mikie said: when I try that from a script that is bootstrapping processwire the $page variable is not available in the Hanna code snippet. Possibly due to this? Quote The $page API variable available to your Hanna code represents the page where the Hanna code exists. It is possible for this to be different from wire('page'), which represents the page that originated the request. Link to comment Share on other sites More sharing options...
Mikie Posted September 30, 2020 Share Posted September 30, 2020 7 hours ago, kongondo said: The $page API variable available to your Hanna code represents the page where the Hanna code exists. It is possible for this to be different from wire('page'), which represents the page that originated the request. That is actually part of what confused me. What that says is the opposite of my experience as outlined above, ie $page in the Hanna Code snippet wasn't scoped to the page with the hanna code. Link to comment Share on other sites More sharing options...
kongondo Posted September 30, 2020 Share Posted September 30, 2020 40 minutes ago, Mikie said: $page in the Hanna Code snippet wasn't scoped to the page with the hanna code. And actually, maybe it shouldn't be possible: Quote You can access all of the same API variables that you can from a template, except that there is no default $page variable accessible from the API since ProcessWire is not handling the web request. Of course, you are welcome to retrieve any page you want from the $pages API variable. Likewise you can modify, save, and delete pages as usual. https://processwire.com/docs/front-end/include/ Link to comment Share on other sites More sharing options...
Ivan Gretsky Posted October 7, 2020 Share Posted October 7, 2020 Good day! I am putting @adrian's TracDebugger's bd() in a Hanna Code and it seem to be running 3 times while rendering only one Hanna code item. Why is that? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now