Comments (32)
I use XAMPP on my local PC. I created a "www" folder to test the scripts.
This script works well on a server. With small code corrections, I was able to customize it to work on my local PC.
from phpagebuilder.
Did you correctly set up the config.php
file, with app_url
set to https://localhost:8080
or similar depending on your installation? Do you see any errors? And do you see a "page not found" if you go to the /
page instead of /admin
page.
from phpagebuilder.
Hi, thanks for the fast reply.
- There is nothing call app_url in the config.php there is base_url and I changed it.
- When I go / I can see a page where it has 2 links one to the admin and another to GitHub.
- When I go to /admin it redirects me to www.localhost which gives an error saying localhost actively refused your connection
Thanks!!!
from phpagebuilder.
Ah yeah you're right, I meant base_url and the default page is also correct. I added that recently. It shows at least that part of the project is working correctly in your environement.
The error "localhost actively refused your connection" I have not seen before, but it seems a webserver related issue. But also the url www.localhost is strange. Can you share the config you are using? And what is the exact URL you are trying to reach, is it just http://localhost/admin ?
from phpagebuilder.
Thank you so much for your reply!
I have all the files at localhost/sysinfo and I use WAMP
and I am trying to go to http://localhost/sysinfo/admin but it redirects me to https://www.localhost (notice the protocol change)
My server config hope this helps you
Server Configuration
Apache Version: 2.4.41
Server Software: Apache/2.4.41 (Win64) PHP/7.3.12 - Port defined for Apache: 80
PHP Version: 7.3.12
MariaDB Version: 10.4.10 - Port defined for MariaDB: 3306 - Default DBMS
MySQL Version: 8.0.18 - Port defined for MySQL: 3308
I use MySQL and i have mentioned port 3308 in the config.php and I have a database named sysinfo with the tables you gave.
Here is my config.php
<?php
return [`
/*
|--------------------------------------------------------------------------
| General settings
|--------------------------------------------------------------------------
|
|`General settings for configuring the PageBuilder.
|
*/
'general' => [
'base_url' => 'http://localhost/sysinfo',
'language' => 'en',
'assets_url' => '/assets',
'uploads_url' => '/uploads'
],
/*
|--------------------------------------------------------------------------
| Storage settings
|--------------------------------------------------------------------------
|
| Database and file storage settings.
|
*/
'storage' => [
'use_database' => true,
'database' => [
'driver' => 'mysql',
'host' => 'localhost:3308',
'database' => 'sysinfo',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
],
'uploads_folder' => __DIR__ . '/uploads'
],
/*
|--------------------------------------------------------------------------
| Auth settings
|--------------------------------------------------------------------------
|
| By default an authentication class is provided which checks for the
| credentials configured in this setting block.
|
*/
'auth' => [
'use_login' => true,
'class' => PHPageBuilder\Modules\Auth\Auth::class,
'url' => '/admin/auth',
'username' => 'admin',
'password' => 'changethispassword'
],
/*
|--------------------------------------------------------------------------
| WebsiteManager settings
|--------------------------------------------------------------------------
|
| By default a basic WebsiteManager is provided for creating/editing pages.
|
*/
'website_manager' => [
'use_website_manager' => true,
'class' => PHPageBuilder\Modules\WebsiteManager\WebsiteManager::class,
'url' => '/admin'
],
/*
|--------------------------------------------------------------------------
| Website settings
|--------------------------------------------------------------------------
|
| By default a setting class is provided for accessing website settings.
|
*/
'setting' => [
'class' => PHPageBuilder\Setting::class
],
/*
|--------------------------------------------------------------------------
| PageBuilder settings
|--------------------------------------------------------------------------
|
| By default a PageBuilder is provided based on GrapesJS.
|
*/
'pagebuilder' => [
'class' => PHPageBuilder\Modules\GrapesJS\PageBuilder::class,
'url' => '/admin/pagebuilder',
'actions' => [
'back' => '/admin'
]
],
/*
|--------------------------------------------------------------------------
| Page settings
|--------------------------------------------------------------------------
|
| By default a Page class is provided with knowledge about its layout and URL.
|
*/
'page' => [
'class' => PHPageBuilder\Page::class,
'table' => 'pages',
'translation' => [
'class' => PHPageBuilder\PageTranslation::class,
'table' => 'page_translations',
'foreign_key' => 'page_id',
]
],
/*
|--------------------------------------------------------------------------
| Theme settings
|--------------------------------------------------------------------------
|
| PageBuilder requires a themes folder in which for each theme the individual
| theme blocks are defined. A theme block is a sub folder in the themes folder
| containing a view, model (optional) and controller (optional).
|
*/
'theme' => [
'class' => PHPageBuilder\Theme::class,
'folder' => __DIR__ . '/themes',
'folder_url' => '/themes',
'active_theme' => 'demo'
],
/*
|--------------------------------------------------------------------------
| Routing settings
|--------------------------------------------------------------------------
|
| Settings for resolving pages based on the current URI.
|
*/
'router' => [
'class' => PHPageBuilder\Modules\Router\DatabasePageRouter::class
],
/*
|--------------------------------------------------------------------------
| Class replacements
|--------------------------------------------------------------------------
|
| Allows mapping a class namespace to an alternative namespace,
| useful for replacing implementations of specific pagebuilder classes.
| Example: PHPageBuilder\UploadedFile::class => Alternative\UploadedFile::class
| Important: when overriding a class always extend the original class.
|
*/
'class_replacements' => [
],
];
This is the page I get when I go to http://localhost/sysinfo/ (This is where the package is)
And when I go over the get started button it shows localhost/sysinfo/admin
But when I click it redirects me to https://www.localhost and this is the error I get!
and here is my .htaccess file
I removed couple of lines in the start seeing some old issues here then only I was able to access the index page.
<IfModule mod_rewrite.c>
RewriteEngine On
# Remove any trailing slashes from non-directories using a redirect
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [R=301,L]
# Rewrite /themes/{theme}/{file} to /themes/{theme}/public/{file}
RewriteRule ^themes/([^/]+)/(?!public/)(.*)$ themes/$1/public/$2 [L]
# Rewrite non-directory and non-file URLs to index.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Allow accessing files with URLs in format /themes/{theme}/public/{file}
RewriteRule ^themes/([^/]+)/public/(.*)$ themes/$1/public/$2 [L]
# Rewrite all remaining requests to index.php
RewriteRule ^ index.php [L]
</IfModule>
My file structure in localhost/sysinfo/
sysinfo
|
|
|---- PHPageBuilder
| |
| |----- Files from this repo
|
|---- PHPagebuilder-boilerplate
| |
| |----- Files from the boilerplate repo
|
|---- themes
| |----demo
| |----some files out here from the boilerplate
|
|---- .htaccess
|
|---- config.php
|
|---- index.php
|
|---- readme.md
|
|---- some files for my project is out here
|
----end----
Thanks!!!
from phpagebuilder.
Thanks for the elaborate details, this helps debugging a lot. I see you have a folder PHPagebuilder-boilerplate
, this is not what I am using. All files from the boilerplate should be in your /sysinfo
folder.
from phpagebuilder.
Yeah actually the PHPagebuilder-boilerplate is empty. Sorry for that..
from phpagebuilder.
Ok, the rest looks good to me. Can you try to set a few breakpoints in this main method: https://github.com/HansSchouten/PHPageBuilder/blob/master/src/PHPageBuilder.php#L242. I am curious whether it already redirects before it enters this method, then I will be a webserver or .htaccess related problem.
Also try to restart your server and try another browser (in incognito mode), to see if it makes a difference.
from phpagebuilder.
Surprisingly it works in Microsoft Edge Browser's Latest version but and also on Incognito Tab in Google Chrome. But does not work in the normal Google Chrome tab. I think its some Extension conflicting.
from phpagebuilder.
If you want to close this issue just close it off. I'm keeping this open because if you want you can ask me anything further. Thanks for your support. BTW can we use this blocks in the editor
from phpagebuilder.
Now I am getting this. I created a page and clicked edit and it's loading for the past 8-10 mins
from phpagebuilder.
Thanks for the great suggestion, clean UI blocks which are very easy to import. I will make sure these blocks become available in the pagebuilder. The point of the pagebuilder now is to add your own custom blocks, which is a matter of creating a new folder for each html snippet you need and then add a view.html inside. However, these blocks can be a good basis together with some bootstrap blocks for a default theme.
Loading the pagebuilder should take at most 3sec, so I suspect there are JavaScript errors in your case. Can you show what your browser console outputs?
from phpagebuilder.
Here is the screenshot of my console. Hope this helps you.
I read the 2 and 4th error in the above picture which said 404 error for two files. So I just moved the themes folder to the root directory and now I got this error.
from phpagebuilder.
Ok, so debugging with the browser console really helps.
In the next error you show I also don't see any causes, so I just followed the error message and opened Theme.php:51 and it tries to open your theme's blocks folder. So the next thing to check is, do you have this folder?
from phpagebuilder.
Yes I have it in www/themes/demo/blocks
Inside it there is only hello-world folder
and all other files of this repo are in www/sysinfo/
from phpagebuilder.
Your project's root directory is www/sysinfo/
, so your themes folder should be in there as well.
Theme.php:51 points to getFolder()
which uses the theme folder config setting. There is a theme => folder
setting in your config.php
. This setting uses __DIR__
which means relative to the current directory of your index.php
. Debugging is just a matter of tracing the code ;)
from phpagebuilder.
@HansSchouten If I move the themes files inside sysinfo I get this error
if I move that folder to www then I get the other error.
from phpagebuilder.
Here you see exactly which files should be in your sysinfo
folder: https://github.com/HansSchouten/PHPagebuilder-boilerplate.
Can you show a screenshot of that folder?
from phpagebuilder.
This is my sysinfo folder. (Highlighted files are my project files).
This is my www folder.
from phpagebuilder.
You should drag your themes
folder into your sysinfo
folder.
from phpagebuilder.
This is the error I get if I move it inside the sysinfo folder.
from phpagebuilder.
I think your general.base_url
config is not correct. You use http://localhost/sysinfo/
to access your website right? And PHPageBuilder is trying to load the theme files from http://localhost/...
In your case the general.base_url
should be http://localhost/sysinfo/
, since this is the base location at which your project lives.
from phpagebuilder.
Sarveshmrao comented 6 days ago
............
Here is my config.php
<?php return [` /* |-------------------------------------------------------------------------- | General settings |-------------------------------------------------------------------------- | |`General settings for configuring the PageBuilder. | */ 'general' => [ 'base_url' => 'http://localhost/sysinfo', 'language' => 'en', 'assets_url' => '/assets', 'uploads_url' => '/uploads' ], /* |-------------------------------------------------------------------------- | Storage settings |-------------------------------------------------------------------------- | | Database and file storage settings. | */ 'storage' => [ 'use_database' => true, 'database' => [ 'driver' => 'mysql', 'host' => 'localhost:3308', 'database' => 'sysinfo', 'username' => 'root', 'password' => '', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', ], 'uploads_folder' => __DIR__ . '/uploads' ], /* |-------------------------------------------------------------------------- | Auth settings |-------------------------------------------------------------------------- | | By default an authentication class is provided which checks for the | credentials configured in this setting block. | */ 'auth' => [ 'use_login' => true, 'class' => PHPageBuilder\Modules\Auth\Auth::class, 'url' => '/admin/auth', 'username' => 'admin', 'password' => 'changethispassword' ], /* |-------------------------------------------------------------------------- | WebsiteManager settings |-------------------------------------------------------------------------- | | By default a basic WebsiteManager is provided for creating/editing pages. | */ 'website_manager' => [ 'use_website_manager' => true, 'class' => PHPageBuilder\Modules\WebsiteManager\WebsiteManager::class, 'url' => '/admin' ], /* |-------------------------------------------------------------------------- | Website settings |-------------------------------------------------------------------------- | | By default a setting class is provided for accessing website settings. | */ 'setting' => [ 'class' => PHPageBuilder\Setting::class ], /* |-------------------------------------------------------------------------- | PageBuilder settings |-------------------------------------------------------------------------- | | By default a PageBuilder is provided based on GrapesJS. | */ 'pagebuilder' => [ 'class' => PHPageBuilder\Modules\GrapesJS\PageBuilder::class, 'url' => '/admin/pagebuilder', 'actions' => [ 'back' => '/admin' ] ], /* |-------------------------------------------------------------------------- | Page settings |-------------------------------------------------------------------------- | | By default a Page class is provided with knowledge about its layout and URL. | */ 'page' => [ 'class' => PHPageBuilder\Page::class, 'table' => 'pages', 'translation' => [ 'class' => PHPageBuilder\PageTranslation::class, 'table' => 'page_translations', 'foreign_key' => 'page_id', ] ], /* |-------------------------------------------------------------------------- | Theme settings |-------------------------------------------------------------------------- | | PageBuilder requires a themes folder in which for each theme the individual | theme blocks are defined. A theme block is a sub folder in the themes folder | containing a view, model (optional) and controller (optional). | */ 'theme' => [ 'class' => PHPageBuilder\Theme::class, 'folder' => __DIR__ . '/themes', 'folder_url' => '/themes', 'active_theme' => 'demo' ], /* |-------------------------------------------------------------------------- | Routing settings |-------------------------------------------------------------------------- | | Settings for resolving pages based on the current URI. | */ 'router' => [ 'class' => PHPageBuilder\Modules\Router\DatabasePageRouter::class ], /* |-------------------------------------------------------------------------- | Class replacements |-------------------------------------------------------------------------- | | Allows mapping a class namespace to an alternative namespace, | useful for replacing implementations of specific pagebuilder classes. | Example: PHPageBuilder\UploadedFile::class => Alternative\UploadedFile::class | Important: when overriding a class always extend the original class. | */ 'class_replacements' => [ ], ];
...........
See this comment!!! Where I have attached the config file.
from phpagebuilder.
Hmm you are right, that is a correct base url. I don't have a clue why it is sending requests to /themes/..
instead of /sysinfo/themes/...
. In this case I would suggest to debug the core helper methods of the page builder to see where it is generating the wrong URLs.
Edit: can you try setting the theme => folder_url
in your config to /sysinfo/themes
? There might be an issue there.
from phpagebuilder.
Wow!!! @HansSchouten thank you so much it worked the problem was with the theme_url.. thanks.
from phpagebuilder.
Great, glad to hear it is solved! However, I would regard this as a bug from my end. The themes folder should be relative to the configured base_url
, or else you need to constantly update two settings. I will keep this issue open untill I've solved that.
from phpagebuilder.
Ok sure! Anyways a very great software!!! but where are the pages saved?
from phpagebuilder.
Thanks! Pages are saved in the pages
table. You can configure this also in your config.php
.
from phpagebuilder.
In my case the admin page works fine, but when I create the page and click on view I get 'Page not found'.
I found this error in PHPageBuilder.php#L284
from phpagebuilder.
Is your page route in the format: /test
, so starting with a slash?
from phpagebuilder.
Yes, my page rout is with slash.
Website Manager work fine. All data stored in db correctly.
The procedure I used:
- Add new page in website manager
- Setting page
In "Url" I was try full urll: http://localhost/www/phpbuilder/test
and short url: /test - Edit page
I was create sample "Hallo world!" page and save it
When I click the "view" button in pagebuilde I got "Page not found".
The same thing happens when I try to see a page from a website manager.
from phpagebuilder.
Please check your config settings. The base_url
should be http://localhost/www/phpbuilder
in your case. However, also double check your webserver environment. In 10+ years I never had to use URLs like that. It looks kind of ugly in the browser and this is error prone as well, especially when trying to figure out what goes into which folder. The www
folder name is usually not something that comes back in your URL, it might be a sign of a mistake somewhere.
from phpagebuilder.
Related Issues (20)
- Important note: how to add static module which get data from database?
- How to clear blocks cache?
- Missing usage references with Framework Laminas
- SQLSTATE[42S22]: Column not found: 1054 Unknown column 'setting' in 'field list'
- Save as plain html in database
- I created a code editing plugin if you want to use it HOT 1
- How can I get Grapejs default block components inside my block HOT 3
- PHP 8.0+ HOT 1
- Index.php HOT 1
- error after installation HOT 1
- CKEditor 4 End of Life
- Pagebuilder is stuck on loading
- image options
- admin Not Found HOT 5
- need help with adjustments!!!
- Documentation guide incomplete
- Integration into Symfony
- PHP 8 HOT 1
- Creating multiple columns where the user can drag blocks in.
- Update my settings based on how many elements are inside the block
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpagebuilder.