Jump to content

Need to create hidden page


Doctor Tyrell
 Share

Recommended Posts

I'm working on my first ProcessWire website and so far I really like the UI. However, I need to create a page that isn't viewable by the outside public to test new code. 

I should mention that the previous developer used the TWIG module, so that makes following the tutorials a bit different.

I've created a template that matches the previous home page, but I'm unable to add the section title / path. The UI just doesn't have anything available. 

When I go to the Pages "Add New" (running the latest Processwire) I only get the "Bookmark" option. 

What's the trick with this?

Screen Shot 2017-12-20 at 6.07.06 PM.png

Link to comment
Share on other sites

I'm not 100% sure if I really get what you are asking for. (?)

I think it isn't possible to create another "homepage" besides the one existing, because it is a unique and single page. It is the root page and cannot have any siblings by design. It is the (root) parent of all other pages.

But when I want to try out new codes in a homepage of a running site, I go into the template file of the homepage and put in a conditional like this:


// on top of the homepage template file
$testingOnTheOpenedHeart = true; // :)

if('horst' == $user->name && $testingOnTheOpenedHeart) { // when I'm loggedIn and have set the conditional to test out something new, ...
    include(__DIR__ . '/_myHomeTemplate4TestingPurposes.php');  // ... include alternative file with my test code ...
    return; // ... and skip the following code from the original template file!
}

// following code
// ...

 

  • Like 6
Link to comment
Share on other sites

I agree with @horst about creating a new homepage - I don't think it will be possible and certainly confusing if it was.

For testing code, I am going to shamelessly promote TracyDebugger. You can use the Console panel to run any code, or if you want to test changes to the code of a particular template, use the Template editor panel which lets you "Test" the changes without actually affecting the code that is being served up to all other visitors.

As for the Pages > Add New and only seeing bookmarks, that is due to your template setup - you need to read up on how to get that add new option working. The main/default way to add a new page is from the "New" action button when you mouseover the parent page in the page tree.

  • Like 4
Link to comment
Share on other sites

Just now, horst said:

Does it also work with PW 2.7 and lower?

I have tested with 2.7 and it works fine. Not sure about anything lower than that, but if there are any problems, I expect they would be restricted to more obscure functionality rather than the module as a whole not working.

  • Like 2
Link to comment
Share on other sites

There seems to be a paradigm religion for / (home) page templates / pages. I've created an unpublished page that is a dup of the Home page, and now the "contexts" don't work, so I'm looking at a page full of errors. Twig isn't the problem at all. I've done my best to config the sub-Home page like the main Home page, but the settings don't seem to match due to the paradigm of how the platform handles a root level page. 

Is that correct? 

Having built a few platforms in my days, I understand the need to force use cases to save time. My client has been held hostage by a previous group and is in desperate need to get this Processwire site updated. The server database is still not accessible, so I'm unable to grab a copy and open up an alternative website. There are so many modules turned on that don't appear to be being used, I'm cautious about being a new PW developer and trying to simulate what WordPress could bang out in an evening. 

I'm running 3.0.42. The tutorials seem to be using a previous interface. 

I guess a general question might be: How does one overhaul an existing PW site without installing a dup? 

Link to comment
Share on other sites

6 hours ago, Doctor Tyrell said:

The server database is still not accessible.

You should have the credentials on the config.php file. From there you can for sure grab a copy easily with a tool like https://www.adminer.org/ or a small script like this https://github.com/2createStudio/shuttle-export. You don't even need that, PW is already connected with the db and can make a backup for you with this module https://modules.processwire.com/modules/process-database-backups/

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...