File Path not rendered in Wappler?

I try to find a solution for that relative absolute path problem but I still dont get it how to solve it.
SO far what I did now is to give a $root path to the project, otherwise its impossible to work locally. My project gets more and more complex and without the possibilty to have real hierachical template or inclusion system I try to have includes over includes. So thats the only way now. But as everything works good, as more I cannot use wappler to have rendered design and previews, as visual part gets broken. Is there any other way to handle path problems?

There is a topic but maybe thats a bit different now.

We allow PHP code in documents, but the PHP code is not executed in the design view of Wappler. The PHP code only works on your webserver, so you should use the browser to preview or rewrite the paths to be absolute.

Hello Freddy,
I don’t understand what are you doing this and why?

Simply use /path/to/file.jpg links for paths relative to site root and ../path/to/file.jpg links for paths relative to document …

This can also be adjusted in Wappler settings.

I tried to replicate the problem without much success.

This is what I have (tried all variations but love this one)

and the result:

The problem is only in the design view of Wappler, not on the web server, there the PHP is correctly executed and paths will work correctly.

@teodor I can‘t go with that way, as I need local development. But as I am including a header File where I cannot tell if I am in a subfolder or not, I used just

/inc/head.php

But that messes up my localhost development.
I need to work locally as I have Internet outtakes and slow connection here. Also its a common way to develop.

Then opened a post here about that relative/absolute path and went with a config file. But then I‘m stuck with design view :sob::sob:

@patrick true on webserver it works. Why not rendering in preview, when rendering in code?

@ben exactly similar solution which I‘ll take. Maybe even I‘ll go with configuration path stored in database. That would fix it, as DB live could have different DB as locally and fetch proper URL root path from config DB column. There are alot of ways how to do path handling, but even changing in wappler my Document root doesnt help as my including is getting complex. Templating would help for that headache here.

To better understand what I really try to get is via multiple and different file including to fake some templating, so changes later would need only small changes.

That topic would solve my problem or is related in a way to it :

@alsdigital I saw your simple way to use kinda template or reusable code snippets, which is exactly which I need. How far can you go with your solution and what you suggest for me?