Search the Community
Showing results for tags 'bootstrap processwire'.
-
Hi, I figured out a strange problem and don't know where to search for the error: I'm trying to include Processwire into an old website project in order to use PW for a little news-system . Therefore I'm using this code. <?php namespace ProcessWire; /*Include ProcessWire f. News */ include $_SERVER['DOCUMENT_ROOT'].("/cms/index.php"); /* Set news variable to get news from PW */ $news = wire('pages')->find('template=news-page');?> Now I'm able to loop through the news and display them as I want to be. <?php /* Section - Aktuelles */ if(count($news)) { ?> <div id="aktuelles" class="section-wrapper section-std-padding container activateMenu"> <h2 class="sectionhead">Aktuelles</h2> <?php foreach ($news as $n) { ?> <div class="box big-image"> <div class="two-text-columns"> <div> <a href="<?php echo ("/cms" .$n->sing_img->url .$n->sing_img);?>" class="img-popup"><img src="<?php echo ("/cms" .$n->sing_img->url .$n->sing_img);?>" class="left" alt="<?php echo $n->sing_img->description;?>" title="<?php echo $n->sing_img->description;?>" style="width: 100%;"></a> </div> <div> <h2><?php echo $n->title;?></h2> <?php echo $n->body;?> </div> </div> </div> <?php }; ?> </div> <?php }; ?> These are the settings for the image field $sing_img And here's the strange thing happening when I try to echo the image: $n->sing_img->url = /cms/site/assets/files/1019/ $n->sing_img = filename.jpg $n->sing_img->size(200,200) = INTERNAL SERVER ERROR Fehler: Uncaught ProcessWire\WireException: Method Pageimages::size does not exist or is not callable in this context in /.../cms/wire/core/Wire.php:519 Stack trace: #0 /.../cms/wire/core/WireArray.php(2212): ProcessWire\Wire->___callUnknown('size', Array) #1 .../cms/wire/core/Wire.php(386): ProcessWire\WireArray->___callUnknown('size', Array) #2 /.../cms/wire/core/WireHooks.php(698): ProcessWire\Wire->_callMethod('___callUnknown', Array) #3 /.../cms/wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Pageimages), 'callUnknown', Array) #4 /.../cms/wire/core/Wire.php(445): ProcessWire\Wire->__call('callUnknown', Array) #5 /.../index.php(120): ProcessWire\Wire->__call('size', Array) #6 {main} thro (Zeile 519 in h.../cms/wire/core/Wire.php) I've no idea why this is happening, perhaps someone of you can give me a hint! Many greets, Jens alias DV-JF
- 1 reply
-
- bootstrap processwire
- include processwire
-
(and 1 more)
Tagged with:
-
I' m trying to get an ajax call working - so that if a user clicks a button a paragraph of text is changing (among other things). The php-file handling the call is in the root directory and bootstrapped. This is the code at issue: <?php // bootstrap ProcessWire // Because this file isn't - and can't be - in the templates directory // see: include('../index.php'); $nlPage = $wire->pages->get("/newsletter/"); $newText = $nlPage->text_without_p_tags; echo $newText; ?> This should return plain text without <p> tags because the field is formatted with "Paragraph Stripper". If I output this 3 lines of code through a regular template file It works like expected but this file returns the text with <p> tags. I would like to know why this is so and how I can solve it. There must be something going on with the bootstrapping or I just don't get it ... Another thing is that if I want to resize and output an image with the field set to "maximum file 1" - thus just one image - to get it working I have to handle it as an array. This confuses me somehow ... Thanks for any help on this!