Jump to content

M.O.Z.G

Members
  • Content Count

    8
  • Joined

  • Last visited

Community Reputation

11 Good

About M.O.Z.G

  • Rank
    Newbie
  • Birthday 12/18/1985

Contact Methods

  • Website URL
    http://mozg-studio.org
  • Skype
    m.o.z.g

Profile Information

  • Gender
    Male
  • Location
    Moscow, RU
  • Interests
    CGi, Design, Freelance, Computer Games

Recent Profile Visitors

1,082 profile views
  1. @adrian I meant all versions that high up this one. It's XAMPP virtual server on the linux machine. May be the problem with db-driven sessions is related to SQLite, but I never felt any problems with this bundle before. I gonna check it in another environment later. I'll write if any new behavior will appear.
  2. Apache 2.4.25, PHP 5.6.30/7.1.1, SQLite 2.8.17/3.7.17 Processwire 3.0.42+ Tracy Debugger 4.1.7+ SessionHandlerDB 0.5.0
  3. Hello @adrian, thanks for orientate. Not Tracy's bug. The problem was with DB-driven Sessions (and yes I have updated PHP, MySQL). When I have uninstalled Session Handler Database module the problem was gone. And it returns if the Module activated again. Moreover, debug bar doesn't work with Master mode with DB-Driven Sessions. That's why Legacy on the screenshot. But once again, it's not Tracy's problem, because some other problems was with sessions after update. Thank you!
  4. Hi, anybody knows what is it? New "previous" lines comes and stays. How to disable this behavior?
  5. M.O.Z.G

    ProcessWire on the web

    Wow! Thanks for sharing, @adrian. Glad to see that the article seems useful. I was afraid that this idiom is very emotional, and thought to delete it later. Now I'm going to keep it
  6. Holy crap! It works the same, with no hand! Thank you LostKobraka, I thought selectors is not "selectors" in this case. I'm still not used to how PW requests all data from the page ... just with simple form of request. It's like a miracle, once again I convinced that. Thank you again!
  7. Thank you for the answers, guys! Oh, it's just product options. Product type, and some parameters, which allows/disallows usage of some other fields. For example: If product_3D_geometry=polys; than next Integer fields will be shown: product_3D_tris, product_3D_vertex, product_3D_polys; but product_3D_voxels Integer field will be ignored. or If product_3D_geometry=nurbs; than product_3D_vertex Integer field will be shown; but next Integer fields will be ignored: product_3D_tris, product_3D_polys, product_3D_voxels. etc... Some parameters may change over time, and hidden fields continue to be stored in the database. That's I want to render lines from loop only for actual parameters. Maybe I'm wrong, but don't see a simple solution at the moment. I had wrote small filter for this task: function compareCondVals( $fieldName, $op, $fieldValue ) { //Allowed operators for Inputfield Dependencies switch( $op ) { case '!=': return !in_array($fieldName, $fieldValue); case '=': return in_array($fieldName, $fieldValue); case '<=': return $fieldName <= min( $fieldValue ); //I know it is stupid to use multiple values in such cases, but just in case. case '<': return $fieldName < min( $fieldValue ); case '>': return $fieldName > max( $fieldValue ); case '>=': return $fieldName >= max( $fieldValue ); case '%=': return $fieldName %= $fieldValue[0]; case '*=': return $fieldName *= $fieldValue[0]; } } function extractConditionalRule ($conditionString) { $patternOperators = '/>=|>|!==|!=|==|=|\*=|%=|<=|</x'; preg_match( $patternOperators, $conditionString, $op ); $op = $op[0]; $conditionValues = explode( $op, $conditionString ); $conditionMultiple = explode( "|", $conditionValues[1] ); $conditionFieldName = $conditionValues[0]; $conditionFieldObj = wire( 'page' )->get( $conditionFieldName ); $conditionFieldType = wire( 'page' )->wire( 'fields' )->get($conditionFieldName)->type->name; if ( $conditionFieldType == "FieldtypeOptions" ) { $conditionFieldValue = $conditionFieldObj->id; //I use IDs for Options fields. } else { $conditionFieldValue = $conditionFieldObj->value; } return compareCondVals( $conditionFieldValue, $op, $conditionMultiple ); }; function extractMultipleConditionalRules ($conditionArray) { $patternSeparator = '/\,\s|\,|\s/'; $conditionArray = preg_split( $patternSeparator, $conditionArray ); foreach ( $conditionArray as $conditionString ) { $conditionSubArray []= extractConditionalRule( $conditionString ); } return min( $conditionSubArray ); } foreach ($page->fields as $field) { $name = $field->name; $showIf = $field->showIf; ... //Other data here $isShown = $showIf != null ? extractMultipleConditionalRules ($showIf) : true; if ( $isShown ) { $fieldsArray[$name] = array( ... //Some data here ); } }
  8. Hello, I want to know, is there any chance to render only visible fields based on their Dependencies? For example, I have many fields in template with conditional logic. But all their values stored in DB, and render in loop with $page->$fields. I could duplicate logic in PHP, but It's seems very inefficient. I couldn't find any API command for such task. Something like flag "isShown". More over, there isn't such flags when I printed array. I just can't find it, or this data keeps somewhere outside? Or is there some other ability to achieve this? Thanks for any advise in advance.
×
×
  • Create New...