Jump to content

dlen

Members
  • Posts

    35
  • Joined

  • Last visited

Everything posted by dlen

  1. Dear forists, I wanted to echo some strings with a simple echo "bla bla"; statement from within a page template. While this works in _main.php and _init.php, I did not get it to work from a page php-template, like "gallery-page.php". There is no error message. Everything else works as expected. This is not an important issue, but I'd like to find some explanation for this, just to not have think about it longer. Thx for any productive hint...
  2. Many thx. Wouldn't have thought so, but downgrading PHP to 7.4 fixed the problem.
  3. Same with me. downgrade to 7.4.13 and template change works again. Who would have thought that?
  4. When I create a new page, i can choose between a couple of templates. but after creation, when i go to the - settings/template dropdown, there is only one template to choose from: The respective template setting is in default, i.e. allows to change the template. Any hints welcome!
  5. Hi, got the same problem. Although there is no deactivation of plugins now, but activation check boxes: I just see no effect... - any hint appreciated.
  6. Thx. I used another solution, which does the job. foreach($languages as $language) { if(!$page->viewable($language)) continue; $url = $page->localHttpUrl($language); $hreflang = $homepage->getLanguageValue($language, 'name'); if ($hreflang == 'home') $hreflang = 'x-Default'; echo "\n\t<link rel='alternate' hreflang='$hreflang' href='$url' />"; The code example stems from the freshly installed multilanguage demo site.
  7. Sure. It is the original code fresh after installation, in _main.php: <?php // handle output of 'hreflang' link tags for multi-language // this is good to do for SEO in helping search engines understand // what languages your site is presented in foreach($languages as $language) { // if this page is not viewable in the language, skip it if(!$page->viewable($language)) continue; // get the http URL for this page in the given language $url = $page->localHttpUrl($language); // hreflang code for language uses language name from homepage $hreflang = $homepage->getLanguageValue($language, 'name'); // output the <link> tag: note that this assumes your language names are the same as required by hreflang. echo "\n\t<link rel='alternate' hreflang='$hreflang' href='$url' />"; } ?> I could live with that for the time being, as it is only an SEO issue, but of course it would be nice having it working.
  8. Brilliant. Now the menu works as advertized and the page URLs reflect the respective language, i.e. '/' in the case of German, '/en/' in the case of English. Only the hreflang attributes in the header links are causing some headscatching: <link rel='alternate' hreflang='home' href='http://butoh-tanz.de/pw/' /> <link rel='alternate' hreflang='en' href='http://butoh-tanz.de/pw/en/' /> The second looks o.k., while the first I do not understand. Shouldn't it be 'de'?
  9. A brilliant tutorial. Did this with the minimal multilanguage site offered for installation. Default language is now German as wanted. Then I uninstalled and reinstalled English. The main menu 'home' link is pointing to 'pw/<german homepage>, which is as it should be, while the 'about' link points to 'pw/en/about', which should be 'pw/about'. In the page settings of the 'about' page the hierarchy of the DE page is 'en/about', while the hierarchy string for the EN page is '/about'. See attached screenshot. The link of the latter is pointing to http://butoh-tanz.de/pw/about/ but clicking it we end up on http://butoh-tanz.de/pw/en/about/. The language menu does show both 'de' and 'en' links, as desired. But the 'en' link points to '/pw' (the processwire root, one level below site root, as this is experimental) instead of 'pw/en/'. Clicking on any link in the language menu does not change anything on any page. The 'home' page stays German while all other pages stay English. So obviously this method does not achieve the goal to completely reverse the language hierarchy, with all German pages having a 'pw/<pagename>' URL and all English pages having a 'pw/en/<pagename>' URL. This is absolutely no critique, as you wrote your tutorial for a single language site. I just would be thankful for a hint how to achieve this URL string reversal.
  10. 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...
  11. 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...
  12. 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.
  13. 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...
  14. 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; }
  15. 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!
  16. 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.
  17. 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.
  18. 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.
  19. 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.
  20. 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.
  21. 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.
  22. 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??
  23. 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 - - -
  24. I find it a little hard to get together the documentation for the $languages - object. Maybe just me.
×
×
  • Create New...