Jump to content

Gary Austin

Members
  • Posts

    25
  • Joined

  • Last visited

Posts posted by Gary Austin

  1. Don't know if this helps, and sorry I don't have time to dig into exactly what you are doing, but if you are on the url for one of these subpages with the servicearea template then the data for that page is in $page without you doing anything in the servicearea template.  The $page variable contains all the field data for the subpage (like "carpenter") that you are on. 

  2. I'm just a beginner at ProcessWire, so not much help as I can't figure out your code/structure at a quick glance as it is structured so different than the way I'm using PW.

    On your first issue with the flag images, you really need to use the code with ul/li that flydev showed you.  Going with a javascript select is really overkill for what you are trying to do as you do not really need a select at all.  Just a ul with li's containing anchor tags and <img src="image url"> tag inserted before the $language-title piece.  Then the the css to make it look like a select (which may work with the classes he provided, but I don't know that piece of code and where the css is coming from).

  3. When you first started this thread you were using Javascript ajax to send your post request... So someone showed how to use $config->ajax to check for request.

    In your latest example you are using a normal html form submit.  To test for submit in that case you would use if ($input->post->submit).

    Javascript ajax and normal html form submit are sent in two different ways to server.

    • Like 1
    • Thanks 1
  4. As far as rendering, for PW side I just generate form html using inputfield rendering as I loop thru the json (converted to PHP array) and generate the form.   I use this technique to generate a version of the form with the ability for the user to modify the option selects and add an extra field or two.   As I said I merge those in with the "fixed" data for each type of note.  

    I also use the same json form data to generate the form and organize the display of note data in javascript on the client side as this is actually for a web app.

  5.  

    I started with a big multi-level repeater field to allow adding an input, specifying its name and picking type (text,select,multiselect) and then adding options if allowed.  I then saved this as a new template by writing json to a file with a name keyed to type of note.  When the user selects to start a note I pull the corresponding json file and generated the form.   I had planned to offer some option with repeater fields to users down the road for generating their own, but right now it is too difficult as notes have 30 or more input select fields with lots of options for each note.  For now I allow a few customization options for each user that gets stored also in a json/text field and then "merge" with an existing note as I generate the final form.

    You could certainly just write the note html versus intermediate structure, but I needed an easy way to allow the user to change select options and the json structure allows me to match the original structure with the user customization at final generation.

  6. So I have a bunch  of templates that define fields for different types of "notes".  I put them under a parent page and then use a Page Reference field on the parent page of the templates.  The user can select from the templates using a radio box (I allow multiple options, but you could use other input options to just get one).  I later then process their templates as needed by reading in the template page and processing it.  To add a new template I just add a page and it is then available without having to edit the option box.

    I may also use a loop on the children of the template parent with my own code to generate the select options.  This would allow the templates having  an extra value to indicate which group of user can see them.  In this case a page reference field would not work easily (that I know of) as I want to filter the templates based on the "type" of user or some other property the user has.

    • Like 1
  7. I tried overriding CSS of the form as the first approach and that did not work.  Basically all the elements have not just standard uikit css, but also Processwire css and changing the form CSS caused lots of other elements to break.

    I might look into creating a new input/field type with all my fieldsets and text inputs in one field as I do store the final value.  Otherwise I'm almost done just not using the API and using a custom admin page.

  8. I have an admin page I want to build with 6 fieldsets of between 6 and 20 text fields each.  I really want the input labels to be inline with the actual input entry field to make the forms readable.  I'm using the uikit admin and it has a horizontal form option for doing so, but it seems processwire wants to lock down the vertical form option which puts label on top of input.  I can't find any api call to change or force this.   I'm actually taking all these fields and generating a single json field to be stored in the database.

    Right now  I'm bailing on the processwire form/field api and just going to hard code my own form and field sets, but would appreciate any advice if I am missing an api call to change the layout of labels/inputs on "back" pages.

    Thanks

  9. Over the past few weeks I had two new Processwire sites I switched to https using SSL certs from Letsencrypt.  

    I had to deal with numerous settings and things with Linux, Apache and my DNS settings (running on a Linode), but at the actual "processwire level" all I had to do was change .htaccess

      # -----------------------------------------------------------------------------------------------
      # 9. If you only want to allow HTTPS, uncomment the RewriteCond and RewriteRule lines below.
      # -----------------------------------------------------------------------------------------------
      RewriteCond %{HTTPS} off
      RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    So i can confirm just changing those two lines is sufficient and all pages work.

    Not much else I can offer, other than you need to look elsewhere for issues than just those two lines in .htaccess

  10. Hmmm.. I run an Invision Board site and can edit posts, but I guess here is either not allowed for "Newbies" or at all.   Anyway @adrian is what I wanted to add to my post. 

    Edit:  I see it must be short time limited...

  11. I'll read it.

    I'm actually triggering a <form method="post" with jquery to send a post variable with my PDF data.  Finally saw 301's and then 200's with no post data and knew something was going a stray...

  12. I know I'm just a "beginner" with Processwire, but just spent hours trying to debug  downloading a PDF with a post variable providing the data for the PDF. 

    I must have missed somewhere the need for a trailing / after the page name to get post variables.  Googling lots of stuff on  templates/ posts/pdf/ etc and finally saw a few threads on the / at end of url meaning something.   Added that and now I get my post data....

    I don't like having to have a / at the end of the url the customer will see, but at least I can move forward now.   Hopefully I missed something obvious...

    Anyway this forum area is entitled the Pub, and I certainly need a drink.

     

  13. 8 minutes ago, rareyush said:
    
    $rating = $item->rating;
    
    	for ($i = 1; $i <= $rating; $i++) {
    
          if ($i <= $page->rating) {
            $rate = "<span class='fa fa-star star selected '> </span>";
          }
          else {
            $rate = "<span class='fa fa-star'> </span>";
          }
      }

     

    I am using this and and I can see only 1 star everywhere, where i am wrong???

    Assuming $rate is the final string you will output later, you need to set $rate="" before loop and use $rate .= "<sp...." in the loops.  the '.=' is the key.

    • Like 2
×
×
  • Create New...