Can't copy Single Page

Permalink
I just started programming with Concrete5 and this is probably a beginner mistake, but I just simply can't solve it.
So I want to copy the single Page "edit_profile" from "Concrete/single_pages/account." But after i copy the file (change the name) and install it through "dashboard/pages&themes/single pages), I can't access it. I get the error-message "Call to a member function output() on null". I have not a single Idea how to solve it.

I wanna thank you all for the answers in advance.

 
hutman replied on at Permalink Reply
hutman
You should also copy the controller for that page from concrete/controllers/single_page/account/edit_profile.php, this is the "brain" behind that page
alexanderkon replied on at Permalink Reply
I did that and renamed it like the singlepage but I get the same error message again.

Thanks for the response
hutman replied on at Permalink Reply
hutman
Ok, so just to be clear you:

Copied concrete/single_pages/account/edit_profile.php to /application/single_pages/another_name.php
Copied concrete/controllers/single_page/account/edit_profile.php to /application/controllers/single_page/another_name.php
Updated the namespace in /application/controllers/single_page/another_name.php from Concrete\Controller\SinglePage\Account to Application\Controller\SinglePage
Cleared the Cache
Did a hard refresh (CTRL + F5)

And you're still getting this error?
alexanderkon replied on at Permalink Reply
I'm working with XAMPP and I have this strange bug that I can't add single pages in "pages&themes/single_pages" when I save them in the application folder. I get the message "That specified path doesn't appear to be a valid static page." when I enter "Application/single_pages/name.php" in the form. (Probably my mistake, I'm new to this).
When I add a single_page that is saved in the concrete/single_pages folder. I don't have to write "Concrete/single_pages/name.php". I feel like it wants me to save in the Concrete folder. (I know that you should never save somehting in there)

Thank you so much for your patience.
hutman replied on at Permalink Reply
hutman
Can you please explain exactly what you're doing?

If you put a single page into application/single_pages/name.php in the Dashboard -> Pages & Themes -> Single Pages you would just enter "name" into the add single page box.

Do not save anything in the concrete directory if you want to keep it after an upgrade.
alexanderkon replied on at Permalink Reply
If i put name.php in Concrete/Single_pages, I only have to enter name.php. and get "Page Successfully Added." But when i put name.php into application/single_pages, i have no idea what to write, because whatever i write, I get the message "That specified path doesn't appear to be a valid static page."
hutman replied on at Permalink Reply
hutman
What version are you working with? I've always just entered "name" without php and it's worked.
alexanderkon replied on at Permalink Reply
concrete5-8.1.0

Well it doesn't matter if add the ".php" or not

It works just fine in the Concrete folder, but it just simply wont work in the applicaion folder
hutman replied on at Permalink Reply
hutman
Is there a reason you haven't upgraded to 8.2.1? There are a lot of bug fixes and security updates in there
alexanderkon replied on at Permalink Reply
No, I will now :))
Let you know if the bug will solve itself with the update
hutman replied on at Permalink Reply
hutman
So I tried this in 8.1 and it still works for me.

application/controllers/single_page/test.php

<?php
namespace Application\Controller\SinglePage;
use PageController;
class Test extends PageController
{
    public function view()
    {
        echo 'in the controller view function';
    }
}


application/single_pages/test.php

<?php
echo 'in the test.php';


Going to Dashboard -> Pages & Themes -> Single page enter "test" into the box and it added fine and when I access the page it says "in the controller view function" on the top of the page and "in the test.php" in the main part of the page.
alexanderkon replied on at Permalink Reply
I just completely reinstalled Concrete5 with the current version and the bug disappeared. I can now easily add single_pages. But i still can't manage to clone the "edit_profile" file. I have the controller in Application/controlllers/single_page and the single page in Application/single_pages and I can easily add the single_page in "pages&themes" but i still receive this "Call to a member function output() on null"
hutman replied on at Permalink Reply
hutman
Can you post the exact code and where you placed it (including filename) like I did above so I can see what's going on?
backupaccount5 replied on at Permalink Reply
Controller:
application/controllers/single_page/yes.php
<?php
namespace Application\Controller\SinglePage\Account;
use Concrete\Core\Page\Controller\AccountPageController;
use Concrete\Core\Validation\ResponseInterface;
use Config;
use UserInfo;
use Exception;
use Concrete\Core\Authentication\AuthenticationType;
use Concrete\Core\Authentication\AuthenticationTypeFailureException;
use Loader;
use User;
use UserAttributeKey;
use Localization;
class EditProfile extends AccountPageController
{
backupaccount7 replied on at Permalink Reply
When I try to comment to post the code of the single_page, my account gets deactivated and I have to create a new one.

So

It is saved in
application/single_pages/yes.php

and its the same code as in Concrete/single_pages/account/edit_profile.php
hutman replied on at Permalink Reply
hutman
Your namespace is wrong, it should be Application\Controller\SinglePage and the class name should be Yes
backupaccount7 replied on at Permalink Reply
It worked.
Thank you so much. :))))