Jump to content

dlen

Members
  • Content Count

    25
  • Joined

  • Last visited

Everything posted by dlen

  1. I had a vicious [] operator not supported for strings (line 133 ….) - problem, after casually upgrading the module. I could not access the backend anymore. I had PHP 5.6 running and tried out 7.0 and 7.1 without success. Then in my desperation I resolved to fiddling the module code (I have pretty weak PHP knowledge). In simplecontactform.module, line 133 , I changed foreach (self::$additionalFields as $f) $allFieldsExtended[] = $f; to foreach (self::$additionalFields as $f) $allFieldsExtended = (array)$f; and at least I was again able to keep on working. But I don't know, whether the module is working fine now, as I have my contact form without module. Might help some poor guy one day...
  2. With this script a strange problem appears: (solution below) When loading first, i.e. with $session->secondvisit nonexistent and setting $user->language to 'de' (in my case), the menu is correctly shown in german the language menu correctly shows the german link as active but the content is shown in the english version the url in the address field does not show the /de characteristic for the german content tree One remark, of which i do not know the importance: the site is redirected to a subdirectory. The URL ist http://agustin-rivas.com. If someone has seen this before and can give a clue, i'll be grateful. -------------------------------------------------------------------------------------------------------- solution --------------------------------------------------------------------------------------------------------- It was a timing problem. I had put the above function into the main template php file, which is executed a f t e r the php files for the different page templates. So the content variables were filled with the $user->language still not correctly set. Moving the function code to the _init.php file, which is executed b e f o r e the page template php files, solved the problem. Took me 2 hrs to figure it out believe it or not...
  3. You are probably right, may be I (or somebody else) adds something to it. For the time beeing i don't see i have the resources for it.
  4. Hi there, I got a template with a field of type "file" in it. If the client did load a file up, a download link is shown - otherwise nothing. The templates name is "termin" and the fields name is "termininfo". middlecontent is some string that collects the HTML. My method to find out, whether a file has been uploaded, is the following: if ($termin->termininfo) $middlecontent .= "<a href='{$termin->termininfo->url}' target='_blank'>INFO</a>\n"; else $middlecontent .= "<a class='hidden'></a>"; My question is, why in some cases, which i cannot really reproduce, the condition $termin->termininfo is false, although a file has been uploaded. This occurs only in a fresh dataset, where no file has been uploaded previously. Maybe there is a better way to check for the existence of the uploaded file. cheers...
  5. An updated version with some more features /** * A recursive menu containing home. * If no root page is given, site root will be taken. * If and only if the second parameter is given, only pages will be included, that have a custom field of type "checkbox", * and the latter has to be checked. This field is the parameter to be given. Example with field "in_main_menu": * * selectiveMenu(null, $fields->in_main_menu); * * All submenu <ul>s get class "submenu". * All <li>s in the direttissima upwards of the page shown - except home - get the class "current". * All menu items, that have the template name 'no_content' do not have a link to their content, but act merely as switches * to their subpages. This template must have also the selector field, if the parameter is given. * * Intended to be used without arguments, i.e. "selectiveMenu();" , i.e. always starting with site root. * * @param Page root page of the menu * @param Field menu_selector_field pages with this "checkbox" field in their template set to "checked" are represented * @param string menu_id The id the outermost ul - tag gets. * @return string */ function selectiveMenu(Page $root = null, Field $menu_selector_field = null, $menu_id = null) { $shownPage = wire('page'); if(is_null($root)) $root = wire('pages')->get('/'); $level = count($root->parents); $ul_class_string = (($level > 0) ? "class='submenu'" : ""); $ul_id_string = ($menu_id ? "id='$menu_id'" : ""); $out = "\n<ul {$ul_class_string} {$ul_id_string}>"; $parents = $shownPage->parents; $items = $root->children; if ($level == 0) $items->prepend($root); foreach( $items as $item) { if ($item->$menu_selector_field || !$menu_selector_field) { $s = ''; $li_class_string = ( ( $parents->has($item) && $item !== $root ) || $item === $shownPage ? "class='current'" : "" ); if($item->numChildren(true) && $item !== $root) { $s = str_replace("\n", "\n\t\t", selectiveMenu($item, $menu_selector_field)); } $href_attr = ( $item == $root || $item->template->name != 'no_content' ? "href='$item->url'" : "" ); $out .= "\n\t<li {$li_class_string}>\n\t\t<a $href_attr>{$item->title}</a>$s\n\t</li>"; } } $out .= "\n</ul>"; return $out; }
  6. Hi, I found a possible cause for the issue when tampering with my own menu function and running into the very same problem. In line 351 of MarkupMenuBuilder.module if($p->numChildren) $hasNativeChildren = 1;// has children to add is the function numChildren used. This function counts in default mode also hidden children. To make it count only visible children, it has to be used with a parameter: if($p->numChildren(true)) $hasNativeChildren = 1;// has children to add I tried it and it seems to work!
  7. Ah, ok. I'll attach all files i think could be relevant. if you want more, just drop a line. It's the "newsletter" item, which has the empty ul.
  8. Thanks for your answer. I can indeed make the empty ul make disappear by setting 'include_children' => 0 in the options. But then, also those items, which shall have their submenu, don't have one. Also, i can switch on an unintended empty ul in another menu, when i set include_children to 1 there.
  9. Hi there, actually I found a solution but I'd like to know, whether there's a better way. PW is installed in a subdirectory /pw/. In root there's the site in pure HTML, which I set up first and then integrated it into PW. Images, CSS and other resources are in subdirectories on the same level as /pw/. Now, as the PW version runs flawlessly, I redirected the domain to the subdirectory, where PW took over. I did this with the provider admin panel, not with some .htaccess in the root directory. The result was, that, with the server replacing all "domain.tld" strings with "domain.tld/pw", all queries to resources ran not to "domain.tld/img/..." but to "domain.tld/pw/img/..." , which gave of course the 500 error. The solution was, to simply copy all resource directories, like /styles, /js, /images &c. into /pw. The more experienced may have a better card in their sleeves? I am interested.
  10. Hi, I got a problem, which makes me scratch my head a lot. I have a menu item with two children, which are 'hidden', but not 'unpublished'. (A newsletter opt in page with landing pages for the double-opt-in-process.) The menu generated looks like this (just the last 3 items): <li> <a href='/pw/de/impressum/'>Impressum</a> </li> <li> <a href='/pw/de/kontakt/'>Kontakt</a> </li> <li class="current"> <a href='/pw/de/newsletter/'>Newsletter</a> <ul class="submenu"> </ul> </li> As one can see, there is an empty ul in the last li. This causes some trouble with some jQuery - mobile - navigation generator. What is puzzling me is, that in a second menu, which just contains this last 3 items (a footer in the non-mobile version) this ul does not appear. I could not find any differences in the menu settings. FYI: runs otherwise smoohtly on pw 3.08 dev.
  11. Actually, people also hire jimdo specialists to take away even this light and - relatively - easy kind of work from them. And i can understand this - they just want to focus on their business and outsource any distraction, or they are still afraid of computers (yes, these people exist). jsww&c have one advantage - they act in a self controlled environment. Pay a little more per month, but no fighting with low RAM, register_globals - settings and the like.
  12. Hi there, I noticed, that one can easily import images from other pages into a textarea field in the backend, while the images field only allows for upload from the local machine. Correct me if i am wrong. Is there a possibility to copy images from another page, e.g. a special image repository page, into an image - type field from the backend, for the average page editor? Thanks for your thoughts.
  13. Hi there, the title says it mostly. I admit I am a bit afraid of the webwork market drying out, because everybody just goes to jsww&c. and sets up his/her site in an hour. And those tools become more sophisticated by the week. Opinions and informations??
  14. Hi there, in an image gallery with the following code foreach ($page->bilder as $bild) { $thumbnail = $bild->size($page->thumbnail_size,$page->thumbnail_size); ... a JS gallery function broke down with the error message: "unitegallery.min.js:6 Uncaught Error: Can't get image size - image not inited." I looked into the /assets/files/nnnn/ folder and found 5 images (of about 16 or so) having api - generated version with only 42 Bytes. 4 of them had the string "....0x0.jpg" in their filename, but the 5th had an unsuspicious filename. They were all generated within the same second, according to their timestamp. In the backend, they could neither be opened nor deleted. Via FTP they could be deleted. This fixed the problem with the gallery. In the /logs/exceptions.txt I found lines like leute_im_boot.0x0.jpg - not a recognized image (in /wire/core/ImageSizer.php line 257) In the errors log I did not find anything apparently related. Did anybody observe something similar? cheers - - -
  15. I find it a little hard to get together the documentation for the $languages - object. Maybe just me.
  16. Hi there, i just want to share the code of what the subject line says. The pages to appear in the menu have a custom field "in_main_menu" of type checkbox checked. The item <li>s of the actually shown page and in the direttissima upwards - except home - get the class "current". The item <ul>s of submenus get the class "submenu". This is basically Ryans Code from here run through a meatgrinder. I hope useful for any beginners like me looking for a solution to a similar problem. Any improvement welcome! Now the code: /** * A recursive menu containing home. (It is added to the list of menu items while $level =1). * In order to be included, a page must have a custom field "in_main_menu" of type "checkbox", * and the latter has to be checked. * All submenu <ul>s get class "submenu". * All <li>s in the direttissima upwards of the page shown - except home - get the class "current". * Takes $root out of the recursion in order to not have all pages twice. * All menu items, that have children, do not have a link to their content, but act merely as switches. * You can switch this behaviour off by replacing * * $href = ( $item == $root || !$item->numChildren ? "$item->url" : "#" ); * * with * * $href = $item->url; * * Or you can make it conditional by querying a second custom field "has_own_page", e.g. * * $href = ( $item == $root || !$item->numChildren || $item->has_own_page ? "$item->url" : "#" ); * * Intended to be used without arguments, i.e. "selectiveMenu();" , i.e. always starting with site root. */ function selectiveMenu(Page $root = null) { $shownPage = wire('page'); if(is_null($root)) $root = wire('pages')->get('/'); $level = count($root->parents); $ul_class_string = (($level > 0) ? "class='submenu'" : ""); $out = "\n<ul {$ul_class_string}>"; $parents = $shownPage->parents; $items = $root->children; if ($level == 0) $items->prepend($root); foreach( $items as $item) { if ($item->in_main_menu) { $s = ''; $li_class_string = ( ( $parents->has($item) && $item !== $root ) || $item === $shownPage ? "class='current'" : "" ); if($item->numChildren && $item !== $root) { $s = str_replace("\n", "\n\t\t", selectiveMenu($item)); } $href = ( $item == $root || !$item->numChildren ? "$item->url" : "#" ); $out .= "\n\t<li {$li_class_string}>\n\t\t<a href='{$href}'>{$item->title}</a>$s\n\t</li>"; } } $out .= "\n</ul>"; return $out; }
  17. Hi , a bloody beginners question: in the function declaration you start with <?php, but you don't end with ?>. Why is this? Thanks...
  18. I found a crude but apparently working solution. I ask if a certain session variable $session->secondvisit exists, which is certainly not the case in the beginning. If not, it will be created and a crude language switch starts working. if (!$session->secondvisit) { $session->secondvisit = true; $locale = locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE']); if (strpos($locale, 'de') === 0) { $user->language = 'de'; } elseif (strpos($locale, 'es') === 0) { $user->language = 'es'; } } This is standing in front of <html>. Any constructive critique welcome. For any language other than German or Spanish, the default language english will be in effect. As the language string is e.g. "de_DE", strpos returns either 0 or false. So querying simply if (strpos($locale,'de')) { ..... } will not work, because the position of 'de' in 'de_DE' is 0 and php takes a 0 for a false, if I am correct.
  19. Hi, I would be interested in this work of yours, too...
  20. Hi, a beginners question to the $form->action = "./" part: Couldn't you just leave the action-attribute out, just do not write it? AFAIK this would have the same effect. I read that "./" means "same directory" and is only in this context interpreted as "same url/file/script".
  21. kongondo, do you have a donation pathway, i d like to buy you 2 coffees or something.
  22. Dear forists, this post is just to help others to find the solution to the issue, which has been mentioned and solved here and in the following post by hansv, and which is currently difficult to spot via Google. Snippets of the error message are No menu items found! MarkupMenuBuilder.module(88) To repeat the explanation given, kongondos Menu Builder, which is really a great piece of software, creates named menu datasets, aka pages, and can in monolingual sites render the respective menus by using the menu dataset / page name. In multilingual sites,though, it currently cannot. One has to resort to other ways of addressing the prepared menu dataset, by its ID. To get the latter, open the menu editing page and look into the address bar. Now render your menu with a string analog to $menumodule->render(1023); (added) Kongondo noted "that you can also pass a menu $page or an array of menu items in addition to the ID." I don't know how exactly to get a menu page object into a variable, so I resort to the ID method. Of course, you can include the options as explained in the readme. This is all redundant information but may be it helps somebody to get it faster.
  23. wow thanks for the quick answer! It takes only 3-4 minutes to reinstall, if the directory is once empty. The latter is a problem with ftp. I logged into the site admin interface of the provider, which has a file manager, and allows to accomplish the complete delete in 2 s.
  24. Dear forists, I just installed pw, using the site profile "site-beginner", having unchecked all others. Now I'd like to explore the "site-default" profile but found out fast, that just replacing the /site/ - directory content by the content of the /processwire-master/site-default/ directory leads only to 404s. This is of course because I replaced this way also the config.php, which throws away the database connection parameters. Are there any other aspects to consider? Or is a quick reinstall the best way to switch site profiles? Any positive comment welcome. Dominik
  25. Hi folks, it showed up again with a shared hosting account at dogado.de. I could remedy it by switching off html5 upload analog to the best answer at the top. Only, in the meantime there has been built in an automatic switch between InitHTML5('') and InitOldSchool() at line 381 or so. The code is if (window.File && window.FileList && window.FileReader && ($("#PageIDIndicator").length > 0 || $('.InputfieldAllowAjaxUpload').length > 0)) { InitHTML5(''); } else { InitOldSchool(); } and this switch criterion fails in the case of said provider. I replaced it with the simple statement InitOldSchool(); which is kind of crude, but it works. In case somebody else wants to do the trick: you have to replace the file InputfieldFile.min.js instead of InputfieldFile.js! So edit the latter, minify it and load it up to wire/modules/Inputfield/InputfieldFile/ . I would consider this a bug, as the system installed without any warnings or error messages - and doesn't work. cheerio Dominik
×
×
  • Create New...