Jump to content

Lance O.

Members
  • Posts

    371
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Lance O.

  1. I typically work with three hosting environments: local, stage (on external server), and live.

    PW currently supports config-dev.php and config.php. I'd love to see support for an additional config file such as:

    config-stage.php
    config-test.php
    config-review.php

    config-local.php
    config-localhost.php

    or something similar. It would make it much easier to manage three hosting environments, each with their own database.

    • Like 1
  2. I'm having issues with using markup regions and including field templates. I'm using a PageTable field to add "stacks" to a page.

    For example, I'm including this in my _main.php file:

    echo "<main id='main' data-pw-id='content'></main>";

    And this in my home.php template:

    echo "<div data-pw-id='content'>";
    echo $page->render('stacks');
    echo "</div>";

    My fields/stacks.php field template looks like this:

    <?php namespace ProcessWire;
    if (wireCount($value)) {
        echo "<div class='stacks'>";
            foreach ($value as $stack) {
                if (!$stack->isHidden()) {
                    echo $stack->render("fields/stacks/{$stack->template}.php");
                }
            }
        echo "</div>"; // stacks
    }

    Then the code for each stack is located in separate field template files like this:

    fields/stacks/stack-intro.php
    fields/stacks/stack-events.php
    fields/stacks/stack-spread.php
    fields/stacks/stack-promo.php

    Unfortunately this approach is not rendering the stack field templates. I'm wondering if the 

    echo $stack->render("fields/stacks/{$stack->template}.php");

    line is causing issues? When I comment that line out and just replace it with a simple echo, the markup region works correctly.

    Debugging shows the following errors, although I'm not sure how to interpret this:

    image.png.dfe9e56ada7e1e126110daae0e34a02d.png

     

     

  3. @teppo

    I appreciate your detailed response. What makes this a risky approach?

    @LostKobrakai

    I did find a way to host both WordPress and ProcessWire in the same directory:

    1. I changed the WordPress index.php to index-wp.php.

    2. I added the following to the ProcessWire .htaccess file (removing the WordPress .htaccess file). The directories here will use WordPress, anything else uses ProcessWire.

    RewriteCond %{REQUEST_URI} ^/(news|category|tag|about)
    RewriteRule .? index-wp.php [L]

    The only caveat to this is that I can't get WordPress to display as the default Home page. But maybe this is a less risky approach to using a proxy service?

    • Like 1
  4. A new client of mine has an existing WordPress site. Because the WordPress site is so large, the client wants to migrate the site section by section into ProcessWire. So as one section in WordPress gets removed, it will be replaced by a redesigned section in ProcessWire and will keep the same urls.

    Can WordPress and ProcessWire coexist on same site? I'm assuming they can't coexist in the same folder on the server, but is there a way to migrate content from WordPress into ProcessWire while keeping the same urls if ProcessWire is installed in a subfolder?

    Once all of the WordPress content is moved into ProcessWire, then the WordPress installation will be completely removed. Looking for advice from someone who has come across the same situation.

    • Like 1
  5. FYI, I include an "ignore" field to my templates that allows for control over a page's visibility in menus, search results, and the sitemap. Then, I add that logic to the appropriate template files:

    image.png.23e6501fad13408fd0685ac54059f9ee.png

    // Hide from XML sitemap
    case ($page->hasField("ignore") && $page->ignore->hasValue("sitemap_ignore")):
    	return "";
    	break;
    
    // Hide child pages from XML sitemap
    case ($page->parent->hasField("ignore") && $page->parent->ignore->hasValue("sitemap_ignore_children")):
    	return "";
    	break;

    Here is the exported field in case anyone else wants to do the same:

    {
        "ignore": {
            "id": 392,
            "name": "ignore",
            "label": "Visibility",
            "flags": 0,
            "type": "FieldtypeOptions",
            "inputfieldClass": "InputfieldCheckboxes",
            "collapsed": 2,
            "optionColumns": 0,
            "tags": "meta",
            "icon": "ban",
            "initValue": "",
            "showIf": "",
            "themeOffset": "",
            "themeBorder": "",
            "themeColor": "",
            "columnWidth": 100,
            "required": "",
            "requiredIf": "",
            "defaultValue": "",
            "export_options": {
                "default": "1=menu_ignore|Hide page from navigation menus\n2=menu_ignore_children|Hide child pages from navigation menus\n3=search_ignore|Hide page from site search results\n4=search_ignore_children|Hide child pages from site search results\n5=sitemap_ignore|Hide page from XML sitemap\n6=sitemap_ignore_children|Hide child pages from XML sitemap"
            }
        }
    }

     

    • Like 1
  6. I want to create a hook that will:

    1. Check for pages with a specific template ("order").
    2. Check that the page has a datetime field that is more than 30 days old.
    3. Send an email to a specific address.
    4. Change the value of a field to show the email was sent.

    What is the best hook method to use? I don't necessarily need this to execute on every page load on the public site, and it can't execute when viewing the specific template ("order"), but it can execute when the "orders" page is viewed on the public site.

  7. @Mike Rockett

    Sure, let me know exactly what you need me to do. Here is the field settings as copied from phpMyAdmin, in case there is something incorrect there:

    {"description":"The Open Graph Image is used when sharing the page to social media services like Facebook and Twitter. Upload images that are **1200 x 630 pixels** for the best display on high resolution devices. At minimum, use images that are **600 x 315 pixels**. Be sure to include a description to be used as the alt tag.","textformatters":["TextformatterEntities","TextformatterStripTags"],"extensions":"jpg jpeg png","maxFiles":1,"outputFormat":0,"defaultValuePage":0,"useTags":0,"inputfieldClass":"InputfieldImage","collapsed":2,"descriptionRows":1,"gridMode":"list","focusMode":"on","resizeServer":0,"clientQuality":90,"overwrite":1,"maxWidth":1200,"minWidth":600,"minHeight":315,"tags":"meta images","icon":"tag","fileSchema":6,"otherField":"License","otherFieldSettings":"{\"cf_textformatter\":{\"license\":\"\"},\"cf_label\":{\"cf_label__license\":\"\"}}"}

  8. @teppo I was using Pete's Markup Sitemap XML, but apparently it has some bugs. I've installed Mike's Markup Sitemap module and it seems to have resolved the issues I was experiencing. I wish it had support for the image license, but otherwise feels like a nice update.

    Edit: Looks like it does support image license.

    Edit 2: But unfortunately it doesn't look like the image license is working correctly. I've reported the issue in that module's support thread:

     

    • Like 1
×
×
  • Create New...