Jump to content

jom

Members
  • Posts

    22
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    Zürich

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

jom's Achievements

Jr. Member

Jr. Member (3/6)

11

Reputation

  1. In the meantime I figured out in which installation the error occured. I upgraded 3.0.210 to 3.0.226. It works well now, running php 8.2.
  2. back in office. sorry guys, I can't reconstruct where it was. All sites running on php 8.1., so I guess I rechanged php version after template change.
  3. i'm on holidays until end of august, can't deliver more details until than ?
  4. samesame. downgrading to php 7.4 works. Using ProcessWire 3.0.210.
  5. ok, this works. I begin to understand slightly more about the mechanisms ? - thanks!
  6. I have a follow up question: How can I get access to the active page from within the __constructor? Something like this: public function __construct(Template $tpl = null) { parent::__construct($tpl); $this->header = page()->title; //does not work } I guess, I have to pass the active page to the constructor? But how/where? In my page template file programmliste.php I refer to the custom class like this: $content = page()->header(); Including the active page here is too late, as the the custom class has already been created, I guess?
  7. ok, beauty, this works. thank a lot, I appreciate very much!
  8. Hi I've started working with custom page classes. The basic example from Ryan's blog post works fine. Now: I'd like to set some object variables, which I can use in my methods. Usually this is done within the __constructor() method. My simplified example: <?php namespace ProcessWire; class ProgrammlistePage extends Page { public $header = ''; public function __construct(){ $this->header = 'some text'; // parent::__construct(); } public function header() { return $this->header; } } This results in an error in my nav function, related to Page.php (Trying to get property 'slashUrls' of non-object in /home/.../wire/core/Page.php on line 3245). What am I doing wrong? I believe I should call the parent::__constructor(), but it didn't work either. I would appreciate a hint, where to look in the docs, because I feel I miss some basic understanding of the underlying mechanisms. Thanks in advance!
  9. Chäs & Co is a b2b cheese trader. They love good cheese and are proud of their excellent knowledge und connections to small cheese producers. They maintain a custom made database and used to copy/paste (!) the cheese infos to the former CMS (Contao). Since substituting the database with ProcessWire was no option, they export now the database to a csv file and import it to the new website (expanded version of module ImportPagesCSV). From there, the pw magic begins. The staff works with the admin interface: They search and find products in notime using the build-in search field (using cheese names or id. Using ids only possible by adding hook, see this forum thread). They generate price lists easily based on a template, providing checkboxes and option buttons for some restrictions, choose i.e. the cheese origin and price audience (all implemented as page selectors). By saving the page a PDF list gets generated (using mpdf, a php pdf library). The visitors can sort and filter the products using a form by shuffle.js. Product details are shown in a popup (fancybox). There's also the option for generating a nice pdf data sheet. No CSS framework being used. Other modules used: ProcessJumpLinks, ProcessProMailer, ProcessWireUpgrade. Visual design: Nicole Haller
  10. beauty! Works perfectly well - thanks! I got stuck in the forum search, looking for admin live search and integer values. I cite here the code, just in case:
  11. i'm at the same point as Ipa: need to add a number field to the admin live search. do I have to copy the module to the site/ folder and change it there?
  12. just for documentation purposes: looks like Ryan added an option in $config: $config->maxUrlSegmentLength = 128; see also:
  13. I just noticed that the folders are deleted now. So maybe it's all fine now. Does anyone know how the deletion works? Does PW execute some cron jobs from time to time which runs over the temp directory?
  14. Olsa, thanks for Somas post. This might be a solution, if wireTempPath won't work. I still hope to get to work. The question is actually quite simple: How can I get wireTempPath to delete it's folders?
  15. Hi everyone It seems that I don't fully understand the wireTempPath() function and I need some help. I use wireTempPath() to create a new location in assets/cache/WireTempDir and than copy a pdf from the assets/files/page folder to the new folder. I want the file to be accessible only for a limited time, that's why I use wireTempPath. The file seems to be copied to the right location, but gets deleted right afterwards, according to As mentioned in the topic above, $wireTempDir->setRemove(false); prevents the file to be deleted. But I like the file to be automatically deleted after a few days. So, how can I do that? My code so far (everything works, but the automatic removal of the tempDir folder): //generate and show download link $folder = time(); // timestamp as temporary folder $maxAge = (int) $settings->options_downloadlink_valid_hours * 3600; //tempDir wants maxAge as seconds $options = array( 'maxAge' => $maxAge ); $wireTempDir = wireTempDir($folder, $options); $wireTempDir->setRemove(false); $src_file = $page->ebook_download->filename; // Create a new directory in ProcessWire's cache dir if(wire('files')->mkdir($wireTempDir, $recursive = true)) { if(wire('files')->copy($src_file, $wireTempDir)){ //get subdirs from tempDir: $pos = strpos($wireTempDir, "WireTempDir"); $subdir = substr($wireTempDir, $pos, 100); $out .= "<p><a href='" . wire('pages')->get('template=passthrough')->httpUrl . "?file=" . $subdir . $page->ebook_download->basename . "' target='_blank'>$page->title</a></p>"; } } I appreciate any ideas - thanks! Oliver
×
×
  • Create New...