Jump to content

suntrop

Members
  • Posts

    322
  • Joined

Everything posted by suntrop

  1. Hi all One of my sites (running PW since 2014, currently v. 2.5.3) had problems with crashed tables. Last week the body field and and image field crashed – noteworthy the latter crashed in a separate DB in my working copy. A couple hours ago another field table crashed (production system again). Funnily, today's table fixed itself. The site has nearly 20,000 pages, about 100 users a day and is installed on a managed server. Unless the logs in sites/assets/logs/errors.txt I have no idea how to research the problem. The hosting company says 'system is fine' and 'mostly it's cased by the CMS'. I have seen others here having that problem, but unless fixing it immediately with repair table there wasn't much info to see what is wrong. Perhaps you guys have some tips how to debug that kind of problem. I even don't know if it is possible to fix this on my own … if it's a problem with the filesystem for example. Any ideas? My code or system failure?
  2. Haven't found any news on this issue, but I saw there is a setLowercase() method and $lowercase property in WireUpload.php Does anybody know how to set it 'false' other than modifying that core file?
  3. Thanks, you should try it if you'r in Cologne I was aware about the 4 character limit of MySQL, it is set to 3 I think on my server, but I thought it just behaves as it wasn't there at all. Lister was able to find the page, despite using the short word. I think I can easily update to the upcoming v. 3
  4. Hi all I have a search box on my website and the results are somehow opaque The page I am looking for has a title of: Em Höttche Search selector is: ~= "Em" -> no results "Em Höttche" -> no results "Em" -> page found "Höttche" -> page found It doesn't matter if I use "em h" or "Em H" I get the exakt same results if I use the search box in PW upper right. Lister however finds the page in all cases. Strange thing is, it doesn't seem to be a problem with the special character "ö", because "Höttche" will get you to the correct result. Front-end search: http://www.biergartenkoeln.de/suchen/?q=Höttche PW 2.6.0
  5. Just parts of the exception are ok to log. I am new to Sparkpost's API and therefor I'd like to log it completely (preferably in one go) … without "disabling" PW to debug my errors :-D
  6. I could test it on another server, but I don't think it is my configuration (which in particular was in your mind)? I am currently on a new vServer and limit is set to 256 MB.
  7. I am using Sparkpost's API to send emails from a template file. Everything works good, but when it doesn't, it fails more than bad, because if I output the error message the server runs out of memory. No matter if I try to display it via print_r(), var_dump() or write to a file with var_export() and file_put_contents() If I disable Processwire's .htaccess and load the file directly (with some modifications to the code) I don't have that problem. The error message will be displayed without any problem. It isn't big < 10 kb In short this is my code <?php // Include SparkMail require 'vendor/autoload.php'; use SparkPost\SparkPost; use GuzzleHttp\Client; use Ivory\HttpAdapter\Guzzle6HttpAdapter; if ($input->post->mailing_submit && is_numeric($input->post->submit_verify)) { // Check for missing fields etc. // … CODE // If all required fields are set, go on if (empty($error)) { // Get recipients $recipients = $users->find($selector); foreach ($recipients as $recipient) { // … CODE } // Send email to users // render template for HTML mail body $httpAdapter = new Guzzle6HttpAdapter(new Client()); $sparky = new SparkPost($httpAdapter, ['key'=>'MYAPIKEY']); try { $results = $sparky->transmission->send([ 'from'=>[ 'name' => 'My Name', 'email' => 'info@example.com' ], 'html'=> $template_html, 'subject'=> 'My subject', 'trackClicks'=> 0, 'recipients'=> $address ]); $success['sent_admin'] = true; } catch (\Exception $spark_err) { echo 'Error: email not sent'; // print_r( $spark_err ); doesn't work => memory exhausted // var_dump($spark_err); doesn't work => memory exhausted $data = var_export($spark_err, true); // doesn't work => memory exhausted file_put_contents($config->paths->logs . date('Y-m-d') . "_sparkpost_error_member_mail.txt", $data, FILE_APPEND); die(); } // End send E-Mail to users } } using PW 3.0.18 with PHP 5.5 on Apache 2.2 Had posted this as an issue at the SparkPost Github repo, but no answer there and I think that has got something to to with PW.
  8. horst, thanks! That one works.
  9. Has anything changed from v. 2.5 to v. 3 when I include/bootstrap PW from another file? The last time I used this in PW 2.5.2 my code worked, but now it doesn't. Some of the API vars are not present and none of the classes are found. require '../index.php'; echo $wire->pages->get("/")->name; // works echo wire('pages')->get("/")->name; // doesn't work $u = new User(); // Error: Class 'User' not found Couldn't find infos if there are changes on how to bootstrap PW in version 3
  10. Hi justb3a Thanks, that one worked for me! But I removed Twig anyway … it doesn't make sense to me.
  11. HI Wanze, many thanks for your help. I didn't get an email … sometimes I feel like the email updates doesn't work quite well. However, articles.php was my controller file. Unfortunately it doesn't work like that. Had tried Smarty but had problems with it too. Maybe I shouldn't use either of them and go with plain PHP.
  12. While this one will work with a simple array, I can't use it to display a multi array This one produces an error when the form isn't submitted {{ input.post.name }} and this one doesn't display anything {{ input['post']['name'] }} Any ideas how to fix this?
  13. Thank you! This one produces the same error message. Truncate doesn't exist Path where I saved the extension should be fine: /site/modules/TemplateEngineTwig/twig/lib/Twig/Extension/Extension/Text.php Isn't it?
  14. Sorry to bother you guys again I tried to add the Text extension to truncate the body for my articles. In my articles.php (will move it to a better place later) I have: $page->addHookAfter('initTwig', $twig, 'addExtension'); function addExtension($twig){ $twig->addExtension(new Twig_Extensions_Extension_Text()); } … and I uploaded this https://github.com/twigphp/Twig-extensions to /site/modules/TemplateEngineTwig/twig/lib/Twig/Extension But I still get the message The filter "truncate" does not exist in "articles.twig"
  15. Ok, then I was wrong Thanks for the hint and link!
  16. Perhaps I was wrong and it doesn't work well with PW 3. {% if page.images|length > 0 %} results in … Fatal error: Exception: An exception has been thrown during the rendering of a template ("Method Page::images does not exist or is not callable in this context")
  17. Wanze, thanks for your reply and help. It works now. I think I mixed up global file template and the inheritance of the template engine. Thanks for the tutorial (and link) as well. Haven't seen it unfortunately. Somewhere about the last sentence made it clear BTW … it works with PW 3 (just smarty has some Notices, but twig works well so far)
  18. Hi Wanze. First, let me say thank you for this module. I was working with a »twig CMS« lately and loved it. So your module is a great and easy way to take this into a PW project. I am struggling with twig’s template inheritance and the global template file in your module. Perhaps I got it wrong – but I thought I can define »app« as my global template file and put in it my html like … // templates/views/app.html <html> <body> <h1>My Site</hi> {% block content %} <p>My Content</p> {% endblock %} </body </html> … and // templates/views/home.html {% extends "app.html" %} {% block content %} <p>My Homepage</p> {% endblock %} Apparently the home.html is somewhere loaded (I get an error message if there is an syntax issue in it) but the app.html is rendered (without the markup in home.html) Do I have to configure something in the controller files? Does the inheritance work like this within your module?
  19. Well, that was simple Haven't thought of using find() behind images. Need to use PW more again. Thanks!
  20. filter() strips out all images without a tag. Those are not in $page->images after using filter()
  21. Thanks. It works The filter method looks far better, but I need the tagged photos later on this page. I tried this one <?php if(count( $page->images->has("tags=''") )): ?> but it is always true, even if there are only images with tags.
  22. There is some data stored with every page you can’t edit and replicate the same data to edit it. That is weird and makes it only more complicated Anyhow, don’t want to bother or be disrespectful for all your help!
  23. The documentation is a little short on this topic … there seems to be only a getTag() and findTag() No way to check if there is a tag at all? The hasTag() method seems to be not allowed on image fields. I want to use an existing image field (something like WordPress’s featured image/post thumbnail) to gather images for a gallery as well. Problem is … <?php if(count($page->images)): ?> <img class="pull-right thumbnail" src="<?php echo $page->images->first->height(300)->url ?>" alt=""> <?php endif; ?> … there are thousands of pages/images without any tags and I can’t tag them all with »featured« to use them as now. Thus I have to tell my template to only use the first image without a tag to use as the featured image. Sounds complicated Hope you know what situation I am in
  24. Thanks, I knew of the SQL »hack«. And I think I’ll have to change it that way. I thought there is some kind of workaround, but as LostKobrakai said there are situations where it doesn’t work well with hooks. I can’t get my head around that limit in PW. Anyway, thanks for the help!!
  25. Hi all I have some kind of blog setup and need to change the page date with a custom date. Since there is no ‚official‘ way to change the created date, I put in a new date field and I want this field – if not empty – always replaces the created date. I could use this hook $this->addHookBefore('Page::render', $this, ‚changeDate'); public function changeDate($event) { $page = $event->object; if($page->template == 'admin') return; if ($page->divergent_date) { $page->created = $page->divergent_date; } } But this only affects the blog article itself. My search page and others seem to »ignore« my overwrite function. Do you know a better hook or way to overwrite entirely the created field for every use case?
×
×
  • Create New...