Jump to content

DarsVaeda

Members
  • Posts

    46
  • Joined

  • Last visited

Posts posted by DarsVaeda

  1. On 10/27/2018 at 6:46 PM, Mike Rockett said:

    @DarsVaeda – Thanks for bringing that up. I did indeed plan to move it some time back, but then decided to only do it for v2, which, hasn't been under active development of late. I'll try find some time to sort this out on v1 soon. Sorry for the issues caused here. ?

    I've just moved it down to the function without anything popping up in error log. Load is down by 90% at least, site speed has improved dramatically as well. I'd suggest you really look into this asap ?

    • Like 2
  2. @Mike Rockett

    // Get the correct table name for ProcessRedirects
            $redirectsTableNameQuery = $this->database->prepare('SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = :db_name AND TABLE_NAME LIKE :table_name');
            $redirectsTableNameQuery->execute(array(
                'db_name' => $this->config->dbName,
                'table_name' => $this->redirectsTableName,
            ));
            if ($redirectsTableNameQuery->rowCount() > 0) {
                $redirectsTableNameResult = $redirectsTableNameQuery->fetch(PDO::FETCH_OBJ)->TABLE_NAME;
                if ($this->redirectsTableName == $redirectsTableNameResult ||
                    strtolower($this->redirectsTableName) == $redirectsTableNameResult) {
                    $this->redirectsTableName = $redirectsTableNameResult;
                }
            }

    Mike, why are you doing this? And why are you doing this in the constructor? As far as I can see it is just used in the "___executeImport" function. Which I suspect is called only once when doing whatever kind of import that is.

    I don't even have that table in my database. Yet as the code is placed in the constructor every time a page is called there is this request to information_schema. This leads to a high database load due to a lot of permission requests.

    I suspect you can move that to the import function?

  3. I actually just found the error this morning. Whilst uploading something went wrong with file rights of the template. When going to the template it actually states so (that it can't access the template and no pages with that template will be displayed).

    But on frontend it's just a 404 and no log entry. Would be nice to get that error as log entry so debugging is a bit easier.

  4. I think I asked this already in another thread. But couldn't this be solved by allowing fields to be reused in a template?

    So instead of having to generate multiple fields (like the text areas in my example) you generate one field but are able to use that one field several times in your template but with different values.
    You would need to put one more level into the table to know which field is which value. And maybe allow to set an identifier for each field so you can specifically call it in the template rather than having to do something like "$page->text_area[x]".


    Isn't this how repeaters works anyway?

  5. 2 minutes ago, AndZyk said:

    I know it is not always that easy but repeaters and the repeater matrix is one possibility to reuse fields on the same template.

    For me repeaters is no problem. And it is no problem for front-end editing. But some users don't use front-end editing and for some cases f-e-d isn't even possible. That's why I can't use them. Some users can't grasp the concept and fail to link where the content goes. Also you can't disable reordering afaik and that also puzzles users.

    Using repeaters would help in most cases actually bringing down the field count a lot.

  6. I don't see any performance issues so far. It's merely a "keeping the overview" thing right now. I don't think there would be any impact in having like 2000 tables in the database. Though it kinda sucks to have one table for one field in one template in one page that has just one row.

  7. Yes I know about template context of fields. That's why I have something like: text_1, text_2, text_...n in my field list.

    @AndZyk

    Unfortunately they change a lot as they are tweaked constantly. But if I would place it into the template, I as a developer, would have to change, test and deploy them. I just want the content person to do this without having me involved in it.

    I'll try to see if I can produce an example to make it more clear, but maybe I'm just on the wrong track ?

    ----

    example:

    I have a page that has several content areas. So first of all I made fieldsets to group them. (Here I could optimize a bit by making general fieldsets instead of landingpage specific ones but I'd still need several of them)

    782546502_test1(5).thumb.png.6ff5f45d07b172ddc253567bd24aab9c.png

    Each set contains a number of textareas that have specific, non-generic content. That's why they are grouped.

    1863136161_test1(3).thumb.png.e87abeec7f23e46481a8a120eea6def0.png

    Code looks something like this.

    <section class="content background_dark">
      <div class="container">
          <div class="row">
              <edit textarea_number_1><?= $page->textarea_number_1 ?></edit>
          </div>
          <div class="row">
              <edit textarea_number_2><?= $page->textarea_number_2 ?></edit>
          </div>
          <?php if (!empty($page->textarea_number_3)) :?>
              <div class="row">
                  <edit textarea_number_3><?= $page->textarea_number_3 ?></edit>
              </div>
          <?php endif; ?>
      </div>
    </section>

     

  8. I still try to grasp the "field" concept of processwire and yet did not manage to do so. Maybe someone can help me to understand the concept?

    I have 14 templates currently. Most of these have fields that are very specific to a template so I wasn't able to reuse fields much. It's not like every template has: an input, a link, a list and an image. Thus I already end up with ~150 fields aka 150 tables. Imagine opening the fields menu...

    Let's say I need to make a new page that has an html form. The form has 15 input fields. So I need 15 x titles, 15 x placeholder texts at least, maybe error & success messages for JS validation and so on.
    This means I need at least 30 processwire text fields just for this one template / page.

    I could use something like a repeater but I don't find this very usability friendly for something like forms for instance.

     

    How would you go about this? Do I miss something that would make my life more easy here or is processwire just not made for that use case?

     

  9. I don't seem to get it to redirect at all. Or maybe I don't get it right? Is this module compatible with processwire 3.0 with multiple languages enabled?

    My source (old url) is: 

    Quote

    de/foobar

    My destination is a selected page that exists.

    If I call https://mydomain.com/de/foobar I just get a 404 instead of the page I'm looking to redirect to.

  10. I'm trying to send a simple form like this:

    <form action="<?= $page->url ?>" method="post">
        <div class="intro_text"><edit html_textarea><?= $page->html_textarea ?></edit></div>
        <?php
            var_dump($_POST);
            if (isset($_POST['send'])) {
                include __DIR__.'/scripts/contact_mail.php';
            }
        ?>
        <!-- some fields -->
    </form>

    This works as long as I'm logged in aka the page is not cached. As soon as I log out the form data is not send seemingly. I can see the page is reloading but the var_dump is just empty.

    How am I supposed to do this in processwire?

  11. Hi,

    I have created a template and will create several pages with it.
    One block on these pages is always the same text that I need to reuse. But it should be editable.

    What is the appropriate way to achieve this?

    I thought I might create a separate template and create a page with it. Then include that page into the other pages via a field.
    But I could not find a field that is working like this.

    Any help is appreciated!

  12. On 08/02/2017 at 10:00 AM, Robin S said:

    Did you check the front-end editing documentation when investigating your problem? It specifically advises against using option B for Repeaters:

     

    Is that documentation up to date? It doesn't work for me with option C. I get a popup which is not usable. Would need to dig into what is wrong with the html/css.
    But option B works for me without any problem (despite the need to set the permission on the system template as you suggested).

  13. On 23/01/2017 at 8:14 PM, DarsVaeda said:

    I tried with:

    
    foreach($page->repeater_field as $item) {
    >?
    <li><edit list_item_repeater<?= $item->id ?>><?= $item->list_item ?></edit></li>
    <?php
    }

     

    This is the actual problem. It doesn't work with this implementation.
    If I use this:

    foreach($page->repeater_field as $item) {
    >?
    <li><?= $item->edit('list_item') ?></li>
    <?php
    }

    Then frontend editing works.

    Thanks @design-a-point!

  14. The problem is that although the data is available in the backend, for some reason the data field of the page does not have the fields (+data) when displaying the page.

    Haven't found the reason though yet. Maybe some connection got lost in the db while switching from single to multilanguage mode?
    But well then the data wouldn't be available with "<?= $pages->get(1)->text ?>" either, wouldn't it?

  15. I enabled language support and now I get "Trying to get property of non-object" for lines like:

    <p><?= $page->text ?></p>

    The content is still available in the backend. On another page I get text from the frontpage with:

    <?php
    $somepage = $pages->get(1);
    ?>
    ...
    <p><?= $somepage->text ?></p>

    This outputs the text although on the frontpage it doesn't. I also do this on the header. On the frontpage I added some fields that are thus "shared" among all pages the content fails with the error for `<?= $page->text ?>` but not for `<?= $pages->get(1)->text ?>`.

    On a third page everything works as expected :huh:

    All three pages have different templates.

    Additionally if the field is wrapped with frontend editing like so:

    <p><edit text><?= $page->text ?></edit></p>

    The page source will end up like this:

    <p></edit></p>

    Before having to dig deep into this:

    Any idea what it could be? I var_dumped $page and that gives an object.

×
×
  • Create New...