Giter VIP home page Giter VIP logo

Comments (32)

kwserp avatar kwserp commented on August 21, 2024 1

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.

HansSchouten avatar HansSchouten commented on August 21, 2024

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.

Sarveshmrao avatar Sarveshmrao commented on August 21, 2024

Hi, thanks for the fast reply.

  1. There is nothing call app_url in the config.php there is base_url and I changed it.
  2. When I go / I can see a page where it has 2 links one to the admin and another to GitHub.
  3. When I go to /admin it redirects me to www.localhost which gives an error saying localhost actively refused your connection
    Thanks!!!

from phpagebuilder.

HansSchouten avatar HansSchouten commented on August 21, 2024

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.

Sarveshmrao avatar Sarveshmrao commented on August 21, 2024

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)
2020-06-30

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!
2020-06-30 (1)

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.

HansSchouten avatar HansSchouten commented on August 21, 2024

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.

Sarveshmrao avatar Sarveshmrao commented on August 21, 2024

Yeah actually the PHPagebuilder-boilerplate is empty. Sorry for that..

from phpagebuilder.

HansSchouten avatar HansSchouten commented on August 21, 2024

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.

Sarveshmrao avatar Sarveshmrao commented on August 21, 2024

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.

Sarveshmrao avatar Sarveshmrao commented on August 21, 2024

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.

Sarveshmrao avatar Sarveshmrao commented on August 21, 2024

Now I am getting this. I created a page and clicked edit and it's loading for the past 8-10 mins

2020-06-30 (2)

from phpagebuilder.

HansSchouten avatar HansSchouten commented on August 21, 2024

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.

Sarveshmrao avatar Sarveshmrao commented on August 21, 2024

Here is the screenshot of my console. Hope this helps you.

2020-07-01

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.

2020-07-01 (1)

from phpagebuilder.

HansSchouten avatar HansSchouten commented on August 21, 2024

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.

Sarveshmrao avatar Sarveshmrao commented on August 21, 2024

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.

HansSchouten avatar HansSchouten commented on August 21, 2024

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.

Sarveshmrao avatar Sarveshmrao commented on August 21, 2024

@HansSchouten If I move the themes files inside sysinfo I get this error
error
if I move that folder to www then I get the other error.

from phpagebuilder.

HansSchouten avatar HansSchouten commented on August 21, 2024

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.

Sarveshmrao avatar Sarveshmrao commented on August 21, 2024

This is my sysinfo folder. (Highlighted files are my project files).
2020-07-03 (1)
This is my www folder.
2020-07-03 (2)

from phpagebuilder.

HansSchouten avatar HansSchouten commented on August 21, 2024

You should drag your themes folder into your sysinfo folder.

from phpagebuilder.

Sarveshmrao avatar Sarveshmrao commented on August 21, 2024

This is the error I get if I move it inside the sysinfo folder.

2020-07-05

from phpagebuilder.

HansSchouten avatar HansSchouten commented on August 21, 2024

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 avatar Sarveshmrao commented on August 21, 2024

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.

HansSchouten avatar HansSchouten commented on August 21, 2024

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.

Sarveshmrao avatar Sarveshmrao commented on August 21, 2024

Wow!!! @HansSchouten thank you so much it worked the problem was with the theme_url.. thanks.

from phpagebuilder.

HansSchouten avatar HansSchouten commented on August 21, 2024

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.

Sarveshmrao avatar Sarveshmrao commented on August 21, 2024

Ok sure! Anyways a very great software!!! but where are the pages saved?

from phpagebuilder.

HansSchouten avatar HansSchouten commented on August 21, 2024

Thanks! Pages are saved in the pages table. You can configure this also in your config.php.

from phpagebuilder.

kwserp avatar kwserp commented on August 21, 2024

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.

HansSchouten avatar HansSchouten commented on August 21, 2024

Is your page route in the format: /test, so starting with a slash?

from phpagebuilder.

kwserp avatar kwserp commented on August 21, 2024

Yes, my page rout is with slash.
Website Manager work fine. All data stored in db correctly.
The procedure I used:

  1. Add new page in website manager
  2. Setting page
    In "Url" I was try full urll: http://localhost/www/phpbuilder/test
    and short url: /test
  3. 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.

HansSchouten avatar HansSchouten commented on August 21, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.