DevPack Collection / Publishing Issues

Over the last day, I have been going round in circles trying to get Collections working in my DevPack. I couldn’t get the Collection setup to work and so I loaded the RealMac acme.table DevPack from Github and installed the component in my DevPack.

I then went through line by line checking mine against acme.table. Corrected a few issues and still the modified acme.table worked in my DevPack but my Collection didn’t. I was seeing property updates that I did in Nova not being reflected in Elements. The only way I could eventually get them to take was to save my Elements project and restart Elements.

Maybe there needs to be a “force reload” button in the Elements UI, to get the reload the latest copy of a DevPack under development?

I then experienced a separate problem where I did a re-publish all files but the website wouldn’t load as it said the RW subdirectory in the backend directory was missing; it was. This was even though Elements had provided the backend path to me (as evidence by a debug error_log message). Again, I quit Elements, restarted Elements and did a re-publish and the backend folder was magically re-instated!

However, now the acme.table collection isn’t finding any rows, even though they exist in the properties and I can add rows. They aren’t shown in the Elements Editor which seems to imply there is a disconnect somewhere? :thinking:

So I have got two separate collections in the same component (mine and modified acme.table), with mine currently working. It seems to me that this area is a little bit flaky as making changes to the Collections in Nova doesn’t always get reflected in Elements, or so it seems? I am not convinced that my collection isn’t going to disappear again with no entries shown and the modified acme.table re-appear?

Anyway, a bit of a ramble but thought I would flag it up! :slight_smile:

It sounds like you might be using the same identifier for both collections, which will certainly cause issues… hard to tell without doing a deep dive on your component!

No , I don’t think so but more than likely it is something that I am doing wrong!

I can email the component to you if that would help?

There is definitely an issue with how Elements is publishing (or not as the case may be). I updated a PHP file in shared/assets and when I published the site, it wasn’t updated.

So I did a publish all and that didn’t update it. I then quit Elements and then restarted Elements and did a Publish All (having deleted all the files on the published site) and then it was updated. However, that process caused another issue as not all the backend RW folders were created with their content.

From my PHP log (edited):

[28-Mar-2025 18:42:12 UTC] $backend_path: ./backend/rw6BBC91D5_50AA_44A1_AED3_2FE25FF7EF79/
[28-Mar-2025 18:42:12 UTC] $site_asset_path: ../rw/elements

...

[28-Mar-2025 18:42:12 UTC] PHP Warning:  require_once(./backend/rw6BBC91D5_50AA_44A1_AED3_2FE25FF7EF79/Parsedown.php): Failed to open stream: No such file or directory

PHP is correct, it isn’t there. I would expect three of these type of sub-folders to be present but only one is. :thinking:

At the moment, quitting Elements, restarting and republishing isn’t resolving the issue.

Excuse me for keeping adding to this thread but I think it is all related?

I am now getting an error from a file: view-post.php which is in the root folder. From the PHP log:

[28-Mar-2025 20:17:43 UTC] $backend_path: ./backend/rw26E9DFB1_F5D0_44E0_AFF1_8A2D29679E3D/
[28-Mar-2025 20:17:43 UTC] $site_asset_path: ../rw/elements

...

[28-Mar-2025 20:17:43 UTC] PHP Warning:  require_once(../rw/elements/com.logrunner.blog/metadata.php): Failed to open stream: No such file or directory 

Note the double dot in front of the /rw/elements/com.logrunner.blog/metadata.php.

The same message from the index.php file (also at the root level) is:

[28-Mar-2025 20:20:03 UTC] $site_asset_path: rw/elements

i.e. No double dot.

Also, the rw26E9DFB1_F5D0_44E0_AFF1_8A2D29679E3D backend folder has decided to reappear after the last Publish :thinking:

If I edit the resultant output view-post.php in the published site and remove one dot, it now works.

1 Like

It’s hard to say without seeing more, but I can give you some pointers. I’m guessing you know the following so just for clarity,

  • All paths in Elements are relative to the page
  • A path starting with / means the root of the file system
  • A path starting with ./ means the current directory
  • A path starting with ../ means the parent directory

The siteAssetPath is relative to where the page is running, either at the root of the site if it’s the home page or within a subdirectory. However, backend php files are nested two levels deeper than the page, backend/[node id]/file.php. So to use the siteAssetPath in a backend php file, you should prefix it with ../../ like this:

$siteAssetPath = "../../{{component.siteAssetPath}}";

Then siteAssetPath should point to the root of the rw/elements directory no matter where the page is located.

Hope this helps

1 Like

Hi @tpbradley,

The issue is that I have these two PHP files at the root level:

index.php [List blog posts] which returns:

[31-Mar-2025 12:15:05 UTC] LIST - $site_asset_path: rw/elements

and view-post.php which returns:

[31-Mar-2025 12:15:18 UTC] VIEW - $site_asset_path: ../rw/elements

which according to your notes above is wrong as the view-post.php is at the root level.

I have temporarily modified my code, to get round the issue, to:

$backend_path = "{{node.backendPath}}";  // ELEMENTS SUBSTITUTION
$site_asset_path = "{{siteAssetPath}}";  // ELEMENTS SUBSTITUTION
error_log("VIEW - \$site_asset_path: " . $site_asset_path);
$site_asset_path = "rw/elements/com.logrunner.blog";  // Awaiting Elements Bug Fix?

Is there something else I should be doing?

Oh interesting, how did you get view-post.php at the root level?

Like this :slightly_smiling_face: :

Oh I see! Ok, yes I see the issue - I’ve added a ticket to look into this. It’s definitely a problem our end.

After digging into this a bit more, it turns out the solution is to explicitly specify a folder for the page. Out of curiosity, was there a particular reason you wanted view-post.php at the top level?

Publishing multiple pages to the same folder can easily lead to file conflicts or other unexpected behavior, so it’s generally best to keep things separated.

Hi Tom, No not specifically but I was trying to test all options as I do not know what users are going to do when the build a website using the Components I am building; especially as Elements allows you to do it. :wink:

So presumably if you are at the root level and specify index.php as the page you are OK, it is just if you add additional php files. like anyname.php?

So I guess, either this needs to be fixed or Elements should prevent you from having additional files at the root level (not sure that is a good idea?).

Yes I think this is the fix, we need better validation on the folder name. We could allow other files at the top level via some other UI if it’s necessary, like a robots.txt file. However, I think pages should always be in a folder.

I’ll ticket this up!