Jump to content

Manaus

Members
  • Posts

    212
  • Joined

  • Last visited

Posts posted by Manaus

  1. Hi,
    just trying to clear knowledge so far.
    I have a template with a "utenti" users field.
    I can get the desired pages with

    $pages->find("template=xx,utenti=$myuser")
    

    But using the api I have to do

    if ($page->utenti->has($myuser)) ...

    I have trouble understanding the differen for the same expression has and =, why not using *= (contains) in the selector? Or $page->utenti = $myuser?

    Thanks

  2. Hello,

    I need to store the pages a user has seen within a field, I'm currently using json_encode(pages array) to store the pages list within a textarea field, but I wonder if there is any better way. JSON use with javascript / ajax / php is making my code a bit bloated, and I'm starting to lose track of the overall design of my app. Is there any better way to keep track of those ids?

    Thanks for any suggestion!

  3. Hello,

    I have a page which is loading three times the same page, with different parameters. 

    This is the code for the called page

    if ($config->ajax) {
        header("Cache-control: no-store, no-cache, must-revalidate, max-age=0");
        header("Cache-control: post-check=0, pre-check=0", false);
        header("Pragma: no-cache");
    }
    
    if ($input->post->proj) {
    	$progettocercato = (int) $input->post->proj; 
    	$progettocercato = $pages->get($progettocercato)->child("title=Comunicazioni")->children("utenti=$user");
    
            // foreach .... 
               // print records etc

    For three calls I get 5, 12, 15 seconds of response time (screenshot) on localhost

    The page is called through an $.ajax function.

    Is it standard ajax behaviour, or am I doing something unnecessary?

    Thanks!

  4. Hello,
    I need to make a recursive function, for printing children of children of ... of pages.
    I placed the function in a separate file, which I include.

    I get a "Error: Call to a member function get() on a non-object"
    This is the code:

    function stampafigli($id) {
      echo $id; // prints 1478
      $messaggi = $pages->get(1478); // raises error
      $messaggi = $pages->get($id)->children();
      if ($messaggi->count):
         foreach ($messaggi as $m):
            if($m->id):
              echo "$m->body" . PHP_EOL;
              stampafigli($m->id);
            endif;
         endforeach;
      endif;
    }
    

    Thanks for any suggestion

  5. I stumbled upon this issue again, but it's getting curious developments...

    It might happen that posts are often modified [adding or removing users from them], so the posts are now appearing 'new' quite often.

    Is there another way to use a per-user state of the posts?

    Just thinking: I might add a list of this-user-has-read linked pages to each post, and everytime the user reads the post, flag the checkbox.

    Thanks for any suggestion...

  6. Hello,

    I have a series of parent pages which have $users, and a series of children pages which inherit such $users.

    Now I'm making a template with a list of pages where I can toggle the users from the children pages. 

    I think I should get the users from the parent, and match against the values sent by the form (the form sends only checked buttons).

    Remove all users then add the confirmed ones?...

    Thanks for any suggestion...

  7. Hello,

    I have a page using this schema: /myhost/mypage/?p=1015

    I would like to add pagination to this page, but I do not know how to configure the url: /myhost/mypage/page2/?p=1015/

    should I use url segments? /myhost/mypage/1015/page2 ?

    Thanks!

  8. Hello, 

    I cannot completely understand the of() function.

    The field is text, textformatter is, say, Markdown. On saving, I put markdown code, why the need of setting of(false) on writing? Why the need to format values in input?

    Thanks!

    • Like 1
×
×
  • Create New...