Jump to content

Hanna Code


ryan

Recommended Posts

  • 2 months later...

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

  • 3 weeks later...

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

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.)

 

 

  • Like 1
Link to comment
Share on other sites

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. 

  • Like 1
Link to comment
Share on other sites

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

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

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

Hi @Dzung,

  1. What is your environment so we can try and replicate (MySQL and PHP).
  2. 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 by kongondo
Link to comment
Share on other sites

18 hours ago, kongondo said:

Hi @Dzung,

  1. What is your environment so we can try and replicate (MySQL and PHP).
  2. 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

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,

  1. Was this a fresh/completely new install? I.e. you didn't import your backup database?
  2. If you did import your backup, have you tried with a completely fresh install? Do you still get errors?
  3. 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

On 9/4/2020 at 11:50 AM, kongondo said:

This is getting weirder! 

  1. Was this a fresh/completely new install? I.e. you didn't import your backup database?
  2. If you did import your backup, have you tried with a completely fresh install? Do you still get errors?
  3. 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

  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...

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

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...