Jump to content

Christoph

Members
  • Posts

    61
  • Joined

  • Last visited

Posts posted by Christoph

  1. I didn't find a solution to use the exploded full name as a sort string for sorting by last_name, so I put a separate last_name field into the template that ist only used for sorting. As I don't want users to fill in the name twice, I did that automatically by checking if the last_name is empty when loading the team page on the frontend.

    I added this code at the top of the teams template, that is showing all the team members

    $team_members = $pages->find("template=team_member, last_name=''");
    foreach($team_members as $team_member) {
        $name = explode(" ", $team_member->title);
        $team_member->of(false); // "turns off output formatting"
        $team_member->last_name = $name[1];
        $team_member->save();
    }

    Now, when I load the page in the front end, the last name is saved into the database and can be used for sorting.
    I'm fine with this workaround, maybe it is useful for someone else ?

  2. Thanks for your reply, Louis!
    I just want a DRY approach. I have a list of team members, all saved as single pages in PW. When adding a new member, I create a new page and put the full name into the title, so I have the name already there, for the URL and for output in the frontend. Now, I don't want to have to input the same name again in further fields like first_name and last_name, just to be able to sort by last_name. This should be possible in an easier way.

    Quote

    However, I dont think you can really apply this to $pages->find() as it returns a PageArray and not a string which you would need for explode. 

    I could get the names with:

    $names = $pages->get("name=parentpage")->children->title;

    Then I could loop through the array and explode the names to get the last name.

    But then I'm to much of a PHP noob to use the result as a property to sort the pages.

    I guess there must be a PHP way to get there, something like usort() or array_multisort(), but – at least for me – to complicated …

  3. Hi there, I have an installation with German admin language . For a date field I want an input like "Mai 2016".
    With PHP date it works fine, problem is, the date within the input field is shown in English like "May 2016".

    For the output I can use strftime %b %Y, which works fine and shows the German month names. If I try this for the admin, the value won't be saved.

    Is there a way to get German month names into the admin input fields? I know it's not a big deal having them in English, as they are very similar. I'm just curious if I'm missing something.

  4. Yes, I read it. 

    As I had no problems using option B with repeaters as a superuser, I just wanted to make it work for other user roles, too. Option C/D is just no real front end editing any more, at least regarding how my clients understand it. In my current client's context, the front end editing is just needed to correct typos and the likes.

    But you are right, as there is a strong advice to not use option B in a repeater context, the docs don't need to provide a solution on how make it work :).

  5. I had the same issues you both mentioned. When logged in with some other role then superuser and try to edit a page, either the text disappeared or I wasn't even able to edit the text, at all.

    The problem comes up, if you want to use option B (explained here: https://processwire.com/api/modules/front-end-editing/ ) for front end editing. 
    I chose it above the other options, because of its direct "inline access" (compared to the dialog box with option C and D). Because repeater fields are stored as child of the admin page in the backend, other user roles don't have access to them by default, which leads to the afore mentioned issues, I guess. 
    My solution was to give those user roles access to the admin page template and its children.

    It took me some time to discover it, so if other users have problems with this, as well, maybe it's worth mentioning it in the module docs somewhere?

  6. Quote

    We currently encounter problems with frontend editing of repeater fields, too: in our case it's simply not possible to frontend-edit repeater fields for users with a specific role, although these users are able to edit the respective repeater fields in the regular backend page editor. Superusers are able to frontend-edit repeater fields as expected.

    This is what @design-a-point wrote in a different thread. I experience the same issue, but couldn't find a solution, yet. Any role other than superuser isn't able to front end edit a field. Any ideas? Thanks for your help!

  7. 12 hours ago, ethfun said:

    Any progress made on this front, @Christoph?

    No. Well, it depends. I've just accepted that Processwire makes no difference between backend structure and frontend/URL structure. I'd still wish for a more flexible approach on this, but currently I get along with it.

    While thinking about it: The question is, if »normal« users use and think about URLs the same way we do. Safari doesn't even show the URL by default …
    It could be an issue in breadcrumbs nonetheless, but I rarely use them in my projects.

  8. Hi there, 

    i  have a little problem with the pagination module.
    I get an archive-list of articles like this

    $articles = $pages->get("/archive/")->children("limit=10");

    and use a foreach to output the result. tThe limit selector tells the pagination module when to create a new page. So far so good.

    Now, I just want to skip the first 10 articles from the archive as they are already shown on the homepage. I'd set the start selector to start=11, but this seem to interfere with my page navigation as the start selector is used here to output the pages.

    What can I do to skip the first 10 articles while still using pagination?
    Thanks for your support!

  9. I rather see a problem for users that might go to a page that doesn't exist.
    This is my biggest concern. Basically I don't mind having a longer URL-structure

    If you make it viewable later on, well, then it would be like rearranging your content structure. You're then adding a layer that helps user finding your content better.

    But if I decide that this layer isn't needed, then I see more sense in leaving this layer out of the URL structure. 

    In the end, it's not the biggest issue, I just want to understand the basic idea behind it, so ist would be great to get some insights on that reasons you mentioned, as I still don't understand it :-)

    • Like 1
  10. On 7.4.2013 at 6:17 PM, ryan said:

    Actually in this case /cities/ is not just about admin organization, it's an important landing page in the site's navigation and breadcrumb trail: 

    http://processwire.com/skyscrapers/cities/

    I think, this URL only makes sense, if there's actually a page that this url refers to. I often create pages, whose only purpose is to keep the admin tidy. If a page is set to unpublished and/or hast no template file and is therefore not meant to be visible, why does it need a place within the URL string?
     

  11. Thanks for your help, again!

    Update: I copied the whole website to a different server and now everything works fine, again.
    The mentioned page that I couldn't edit before is now editable, but what I recognized is, that it takes a few seconds to load the page in the admin.
    I'm using a repeater field to manage a ton of dates (> 50) and I guess that this could've been a problem for the old server?
    Nonetheless, everything fine for now.

  12. Thanks for your help, guys!

    Now, I think I've crashed the whole thing.
    Just changed ProcessPageEdit.module and I'm getting  "error: class 'Process not found in ProcessPageEdit.module

    Changed it back and error ist still there. What's going on here?  :(

    @Arjen

    Before I changed ProcessPageEdit.module I created a testpage with the same template. could edit it without any problem.

    And yes, there was one page in the trash with this template

  13. Hi Arjen, 
    thanks for your reply.

    I try to provide a bit more:

    The template uses a few text fields and a repeater field (where most of the client's changes happen)

    There is just one page using this template. (Although the overview under setup > templates says "2")

    I turned on $config->debug but it didn't show any further hint.

    The front-end just works perfect. The page using that template shows all infos. No errors.

    Unfortunately I have no local environment for this project.

  14. I've a strange problem I never run into before.

    When I try to edit one special page in the admin, I get this:

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

    I can edit every other page except one.
    I can't find anything in the server log files and there is no hint in the assets/logs error file.

    I'm using PHP 5.6 and PW 3.0.5
    Until 2 days ago, everything worked just fine, maybe it's related to the fact that the client edited the page recently?
    But I can't figure out what the problem is.
    Thanks for some hints!

     

  15. Thanks for your quick reply!

    Find doesn't work in this context and produces an error:

    Error: Call to a member function find() on a non-object

    As I only need one page (the one where the repeater is included), I think "get" is ok here.

    Your second idea sounds promising, but unfortunately, the code doesn't work either.

    Anyway, thanks for your support!

×
×
  • Create New...