Jump to content

CalleRosa40

Members
  • Posts

    25
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling
  • Location
    Leipzig/Germany

Recent Profile Visitors

923 profile views

CalleRosa40's Achievements

Jr. Member

Jr. Member (3/6)

6

Reputation

  1. It's not the number of variables that makes my code lengthy but rather the amount of (conditional) HTML I have to put inside them. Thanks anyway!
  2. This works. Great. Thanks a lot, @Robin S! (But I still don't get why my content variables get dropped when the files holding them are pulled in with include_once ...)
  3. Hi @aagd, Thought of that, too. All my templates are being auto-compiled, so that shouldn't be a problem. I also tried adding namespace spec manually to the files – didn't help. Thanks anyway.
  4. Thank you, @Robin S. I'd say that is exactly what I did from the very beginning. Here's the the essential part of my _init.php (which is automatically prepended to all my template files): include_once('_func.php'); include_once('_header.php'); include_once('_sidebar.php'); include_once('_footer.php'); include_once('_buttons.php'); _func.php contains all of my functions. I pull in _header.php etc. to define the variables (holding HTML) which are then output in _main.php. I put the declarations into separate files for better overview (_init.php would get rather lengthy if I didn't). That is a vaild way to go, isn't it? However, when throwing the 404 exception in my template like this if($user->hasRole("abc") || $user->hasRole("xyz") || $user->isSuperuser()) { ... } else throw new Wire404Exception(); the 404 page is displayed but with PHP warnings about not finding my content variables (which are needed to put the 404 page together, for menus etc.). The included files seem to get loaded because I can call functions defined in _func.php in my template. However all variables defined in _header.php etc. get "lost" somehow. Why? Thanks again!
  5. Hi everyone, I read the thread, however I still experience some strange behavior. I suspect it has to do with delayed output, but I don't get it. For certain cases (ie URL segments that shouldn't be accessible for guests) I need to manually throw a 404 exception in one of my templates. First I got a compile error about not being able to redeclare some function. I fixed that by replacing all includes in my (auto-prepended) _init.php with include_onces. Now my 404 page is displayed but incompletely. PHP gives me multiple warnings about undefined variables in _main.php – those variables that are defined in the files I include in _init.php. What's going on here? I'm sure there is a simple reason, I just can't figure it out. Any ideas? I'll be most grateful for any hint!
  6. Hi, Why does this <?php $test = urls('templates'); $templateCSS = ' <link rel="stylesheet" href="' . urls('templates') . 'styles/uikit.min.css"> <link rel="stylesheet" href="' . urls('templates') . 'styles/tom-select.css"> '; work in PW 3.0.165 and not this? <?php $templateCSS = ' <link rel="stylesheet" href="' . urls('templates') . 'styles/uikit.min.css"> <link rel="stylesheet" href="' . urls('templates') . 'styles/tom-select.css"> '; Second snippet makes PW throw "Fatal Error: Uncaught Error: Call to undefined function urls() in ...". First snippet outputs okay. These are the first few lines of one of my templates. Sorry, if this is a dumb question, but I really don't get it. Am I being blind? Can anyone put me on the right track? Thanks a lot.
  7. Hi, I'm trying to configure PW 3.0.165 admin page search to behave as follows: - search in title field while typing - search in body and title fields upon pressing enter Module config clearly allows for that (settings "Page fields to search" and "Page fields to search if user hits 'enter'"). However, PW seems to consider the first setting only, meaning that upon pressing enter PW still only searches in title field. Only when I add body field to first setting it gets searched (on hitting enter as well). Same behavior on a clean install. Can anybody confirm this (or tell me what I'm doing wrong)? Thanks a lot. (Btw, it would be nice if the search results page would give some info about the search term(s) used.)
  8. One more tiny little thing. CKEditor's source view does not seem to work with AOS enabled. Entire screen (including modal) gets dimmed. Upon clicking OK to close modal, the page even "freezes", making it necessary to reload. Is anyone else experiencing this behavior? Sorry, forgot to do proper forum search first. Bug has been covered.
  9. @Robin S, you were spot-on. Thanks! I configured AOS AddNewChildFirst for template of parent page. My bad. Now everything seems to work fine. However, name of submodule is kind of misleading IMHO ... @horst, thanks to you, too! And thanks for your work, your module served me well for a long time. P.S. Just realized that Privacy Bagder add-on prevents automatic "@user name" in Firefox ...
  10. Hi there, Thanks for an awesome module! I only recently discovered AddNewChildFirst, before that I used @Horst's older module (Pagetree Add New Childs Reverse) to have new pages placed at the top of the page list. After uninstalling Horst's module, I tried to replace its functionality with AddNewChildFirst by enabling the submodule for the template I need it for. Unfortunately that didn't work. Has anyone managed to do this? Is it like with Horst's module that it doesn't work on pages that already have existing child pages? The docs don't say anything about it. Or is it that Horst's module modified my pages in a way that collides with AddNewChildFirst's workings? Any hints are appreciated!
  11. @teppo Thanks for your help! Sorry for the delay (and sorry I have to get back to this). Yes, you're right, I use Hanna Code on my site. My code works fine though except when called by your indexer. I noticed another thing: When trying to save the page which calls my HC, PW gives the same error as above. This is the content of my HC causing the trouble: if($page->images_gallery->count()) { // images_gallery is a repeater field $gallery = "<div class='gallery'>"; foreach($page->images_gallery as $img) { if($img->image_caption) { $titleAttr = "title='" . strip_tags($img->image_caption) . "'"; $imgCaption = "<div class='lightbox-caption'>$img->image_caption</div>"; } else { $titleAttr = ""; $imgCaption = ""; } $gallery .= " <a href='{$img->image->url}' $titleAttr> <img src='" . $img->image->size(250, 250)->url . "' alt='" . $img->image->description . "'> $imgCaption </a> "; } $gallery .= "</div>"; echo $gallery; } This is tailored to output formatting being on, as is usually the case when HC is called. How does your indexer handle OF when it pulls content from fields? I'm still confused by the fact that triggering your indexer via API does NOT lead to any error. The error seems to appear only when the backend is "involved". Any ideas? Thanks a lot!
  12. Hi @teppo, Thanks a lot for your module! Whenever I check "Index pages now?" in the module's backend config and save to build/rebuild the index field, PW throws a lenghty error (see attached PNG). I've selected a couple of text/textarea fields to index and included the index field in my templates. Calling $modules->get('SearchEngine')->indexPages(); from the search template seems to work fine though. Am I making some newbie mistake here or is that an actual bug?
  13. Hi, I had this piece of code in my template file's head section, a fix for older IE browsers: <!--[if lt IE 9]> <script src="<?=$config->urls->templates?>js/html5-3.6-respond-1.4.2.min.js"></script> <script src="<?=$config->urls->templates?>js/rem.min.js"></script> <![endif]--> EMO 1.2.2 inserted its own code inside the conditional comment which resulted in it not working properly (in browsers other than old IE, of course): <!--[if lt IE 9]> <script> var emo = emo || {}; emo.key = 'PDHeN7ZbGViB1m0ATUpc5rC3tY_8fgEqkl6dw2nMKQSLxWouahI.4vJFyOXzs9Rj'; </script> <script src="/site/templates/js/html5-3.6-respond-1.4.2.min.js"></script> <script src="/site/templates/js/rem.min.js"></script> <![endif]--> I don't know the exact way EMO determines where to place its code, but it should probably make sure its JS does not end up in any conditional comment. Apart from that, thanks a lot for a very useful module. Michael
  14. Hi all, I'm using the current version of MarkupCookieConsent on PW 3.0.62, but it doesn't seem to work anymore (used to work fine a while ago). No error message whatsoever is displayed, but still no cookie is set (checked it in browser as well as on module's config page). The consent message isn't displayed either. I've already deleted/reinstalled the module two times. Is anyone else experiencing the same problem? Suggestions? Thanks a lot! Michael
  15. $page->editUrl is still lacking from the cheatsheet. (However, it has found its way into the API reference, cf. https://processwire.com/api/ref/page/edit-url/.) Would be nice and helpful if somebody could fix this. The cheatsheet is still being maintained, right?
×
×
  • Create New...