DV-JF
-
Posts
294 -
Joined
-
Last visited
-
Days Won
1
Posts posted by DV-JF
-
-
Hello everybody,
I would like to show you one of my last projects:
Would be great if you could give me some feedback !
Here some technical details:
- Main modules used:
- FieldtypeCropImage
- FieldtypeMapMarker
- ProcessRedirects
- Front-End-Scripts:
- Stellar.js
- jQuery Easing
- Magnific Popup
- jQuery Waypoints
- 7
- Main modules used:
-
Glad you got it working.
Just to clear things up for people searching the forums, I just edited the title of this post from the original: "How To Use A Method From Another Module In Own Module" since this is more specifically about image fields.
I don't think it really is documented anywhere at the moment - definitely something that should be explained somewhere.
Thx again Adrian. btw: is it possible to edit the title by myself?
-
You are my heros !!! Thank you so much!!!
What Soma is getting at is that because you are in a module context, the "image field to 1 max image" setting doesn't work to convert the image field from an array to a single image, so you must use first().
Is this somewhere documented?
-
Ah youre in module so no ouputformat so an file.field is always a wirearray. Hence the Pageimages error and not Pageimage.
Can you please explain what you mean exactly?
-
Or just change you image field to 1 max image
I've done this before.
EDIT: Sorry, didn't know that this will have no effect if trying to target the field form a module
I've change this line:
$slides = $this->pages->find("section_img!=''");
to
$slides = $this->pages->find("section_img.count>0");
but still get this error:
Session: Method Pageimages::getThumb does not exist or is not callable in this context.
@Horst and Soma: This code I've posted first was working when it was a template file. Now I'm trying to migrate it to a module in order not to be loaded everytime a page is visited.
This is how I init the funktion:
public function init() { $this->pages->addHookAfter('save', $this, 'createcss'); }
Any ideas?
-
Hi,
I'm trying to build my first module:
It should create a css file for responsive background images. In order to do this I'm searching for a specific field (section_img) and try to write all thumbs - build with Apeisa Thumbnails Module - to an array. After this I'm looping through this array and return the css structure.
I first tried out this code on a normal page-template and everything works fine. Now when I try to execute the code I get an error:
Session: Method Pageimages::getThumb does not exist or is not callable in this context
Here's an excerpt of the code:
public function createcss($event) { $slides = $this->pages->find("section_img!=''"); $name = array(); $smp = array(); $sml = array(); $lmp = array(); $lml = array(); $tap = array(); $def = array(); foreach($slides as $s) { $bgImg = $s->section_img; array_push($name,$s->name); array_push($smp,$bgImg->getThumb('small-mobile-portrait')); array_push($sml,$bgImg->getThumb('small-mobile-landscape')); array_push($lmp,$bgImg->getThumb('large-mobile-portrait')); array_push($lml,$bgImg->getThumb('large-mobile-landscape')); array_push($tap,$bgImg->getThumb('tablet-portrait')); array_push($def,$bgImg->url); }; // Small Mobile - Portrait $out = "@media only screen and (max-width: 320px) {.slide.imgContainer{min-height:20rem;}"; for($i = 0; $i <= 5; $i++) { $out.=".section_".$name[$i]."{background-image:url('".$smp[$i]."');}"; } $out.= "}"; // Small Mobile - Landscape $out.= " @media only screen and (min-width: 320.1px) and (max-width: 480px) {.slide.imgContainer{min-height:30rem;}"; for($i = 0; $i <= 5; $i++) { $out.=".section_".$name[$i]."{background-image:url('".$sml[$i]."');}"; }; $out.= "}"; // Large Mobile - Portrait $out.= " @media only screen and (min-width: 320.1px) and (max-width: 480px) and (orientation: portrait) {.slide.imgContainer{min-height:30rem;}"; for($i = 0; $i <= 5; $i++) { $out.=".section_".$name[$i]."{background-image:url('".$lmp[$i]."');}"; }; $out.= "}"; // Large Mobile - Landscape $out.= " @media only screen and (min-width: 480.1px) and (max-width: 960px) and (orientation: landscape) {.slide.imgContainer{min-height:30rem;}"; for($i = 0; $i <= 5; $i++) { $out.=".section_".$name[$i]."{background-image:url('".$lml[$i]."');}"; }; $out.= "}"; // Tablets - Portrait $out.= " @media only screen and (min-width: 480.1px) and (orientation: portrait) {.slide.imgContainer{min-height:50rem;}"; for($i = 0; $i <= 5; $i++) { $out.=".section_".$name[$i]."{background-image:url('".$tap[$i]."');}"; }; $out.= "}"; // Default Desktop $out.= " @media only screen and (min-width: 960.1px) {"; for($i = 0; $i <= 5; $i++) { $out.=".section_".$name[$i]."{background-image:url('".$def[$i]."');}"; }; $out.= "}"; $css = fopen("/css/resbg.css", 'w'); fwrite($css, $out); fclose($css); }
Any ideas how I con use the ->getThumb() method working?
Many greets, Jens.
-
Hi adrian, hi Soma,
adrian, you where right: I have set a field decency in this template wrong: Used =* instead of *=
Thanks for the hint...
-
Hi,
when I try saving a specific page I get an error:
Unknown Selector operator: '=*' -- was your selector value properly escaped?
When I put on debug mode:
TemplateFile: Unknown Selector operator: '=*' -- was your selector value properly escaped?<pre>#0 D:\wamp\www\example\wire\core\Selectors.php(193): Selectors->create('body', '=*', 'linklist') #1 D:\wamp\www\example\wire\core\Selectors.php(62): Selectors->extractString('body=*'linklist...') #2 D:\wamp\www\example\wire\modules\Inputfield\InputfieldForm.module(105): Selectors->__construct('body=*'linklist...') #3 D:\wamp\www\example\wire\modules\Inputfield\InputfieldForm.module(66): InputfieldForm->processInputShowIf(Object(WireInputData), Array) #4 [internal function]: InputfieldForm->___processInput(Object(WireInputData)) #5 D:\wamp\www\example\wire\core\Wire.php(359): call_user_func_array(Array, Array) #6 D:\wamp\www\example\wire\core\Wire.php(317): Wire->runHooks('processInput', Array) #7 D:\wamp\www\example\wire\modules\Process\ProcessPageEdit\ProcessPageEdit.module(696): Wire->__call('processInput', Array) #8 D:\wamp\www\example\wire\modules\Process\ProcessPageEdit\ProcessPageEdit.module(696): InputfieldForm->processInput(Object(WireInputData)) #9 [internal function]: ProcessPageEdit->___processInput(Object(InputfieldForm)) #10 D:\wamp\www\example\wire\core\Wire.php(359): call_user_func_array(Array, Array) #11 D:\wamp\www\example\wire\core\Wire.php(317): Wire->runHooks('processInput', Array) #12 D:\wamp\www\example\wire\modules\Process\ProcessPageEdit\ProcessPageEdit.module(159): Wire->__call('processInput', Array) #13 D:\wamp\www\example\wire\modules\Process\ProcessPageEdit\ProcessPageEdit.module(159): ProcessPageEdit->processInput(Object(InputfieldForm)) #14 D:\wamp\www\example\wire\modules\Process\ProcessPageEdit\ProcessPageEdit.module(109): ProcessPageEdit->processSave() #15 [internal function]: ProcessPageEdit->___execute() #16 D:\wamp\www\example\wire\core\Wire.php(359): call_user_func_array(Array, Array) #17 D:\wamp\www\example\wire\core\Wire.php(317): Wire->runHooks('execute', Array) #18 D:\wamp\www\example\wire\core\ProcessController.php(196): Wire->__call('execute', Array) #19 D:\wamp\www\example\wire\core\ProcessController.php(196): ProcessPageEdit->execute() #20 [internal function]: ProcessController->___execute() #21 D:\wamp\www\example\wire\core\Wire.php(359): call_user_func_array(Array, Array) #22 D:\wamp\www\example\wire\core\Wire.php(317): Wire->runHooks('execute', Array) #23 D:\wamp\www\example\wire\core\admin.php(64): Wire->__call('execute', Array) #24 D:\wamp\www\example\wire\core\admin.php(64): ProcessController->execute() #25 D:\wamp\www\example\wire\modules\AdminTheme\AdminThemeDefault\controller.php(13): require('D:\wamp\www\mar...') #26 D:\wamp\www\example\site\templates\admin.php(15): require('D:\wamp\www\mar...') #27 D:\wamp\www\example\wire\core\TemplateFile.php(140): require('D:\wamp\www\mar...') #28 [internal function]: TemplateFile->___render() #29 D:\wamp\www\example\wire\core\Wire.php(359): call_user_func_array(Array, Array) #30 D:\wamp\www\example\wire\core\Wire.php(317): Wire->runHooks('render', Array) #31 D:\wamp\www\example\wire\modules\PageRender.module(337): Wire->__call('render', Array) #32 D:\wamp\www\example\wire\modules\PageRender.module(337): TemplateFile->render() #33 [internal function]: PageRender->___renderPage(Object(HookEvent)) #34 D:\wamp\www\example\wire\core\Wire.php(359): call_user_func_array(Array, Array) #35 D:\wamp\www\example\wire\core\Wire.php(317): Wire->runHooks('renderPage', Array) #36 D:\wamp\www\example\wire\core\Wire.php(381): Wire->__call('renderPage', Array) #37 D:\wamp\www\example\wire\core\Wire.php(381): PageRender->renderPage(Object(HookEvent)) #38 D:\wamp\www\example\wire\core\Wire.php(317): Wire->runHooks('render', Array) #39 D:\wamp\www\example\wire\modules\Process\ProcessPageView.module(152): Wire->__call('render', Array) #40 D:\wamp\www\example\wire\modules\Process\ProcessPageView.module(152): Page->render() #41 [internal function]: ProcessPageView->___execute() #42 D:\wamp\www\example\wire\core\Wire.php(359): call_user_func_array(Array, Array) #43 D:\wamp\www\example\wire\core\Wire.php(317): Wire->runHooks('execute', Array) #44 D:\wamp\www\example\index.php(194): Wire->__call('execute', Array) #45 D:\wamp\www\example\index.php(194): ProcessPageView->execute() #46 {main}</pre>
I don't know where I have to search for this error... Any hints?
Many greets, Jens alias DV-JF.
-
Hi netcarver,
while writing my answer I tried out your last hint:
Edited to add 2: [...] Also, is there a .htaccess file in www/? I see from Stack Overflow that you can get double domain parts if you are missing a readable .htaccess where you expect it (or it doesn't have mod_rewrite info) but one exists in the parent directory.
The provider did some strange mapping via htaccess in the main folder:
## SITECON-CODE: SUBPATH (C167) ## RewriteEngine on RewriteCond %{HTTP_HOST} ^(www\.|)example.com$ [NC] RewriteCond %{REQUEST_URI} !(^/example.com/|^/sitecontrol|^/_md/|^/icons/) RewriteRule ^(.*)$ /example.com/$1 [L] ## SITECON-CODE: END (C167) ##
That caused the error. I decided to move the Webseite to the main folder on the server and now everything works fineMany thankx !!!
- 1
-
Hi all,
I've been using PW now for quite a long time, but now I'm stuck with a strange URL rewrite problem and I don't know if it's a problem with my server setup or a PW specific problem:
- URL for the site: http://www.example.com/
- FTP folder: www/example.com/
- URL is maped to this folder
RewriteBase /
Everything works fine, except, that the folder name is repeated in every URL after the domain (even the admin URL) when I click on a link, e.g.:http://www.example.com/example.com/team/
The strange thing is that when I try to open the URL "as it should" behttp://www.example.com/team/
is also worksI've tried different this like renaming setting
RewriteBase /example.com
but this doesn't change the behaviour.For testing I set up a subdomain
and here everything is fine
I don't know where to search any more, perhaps some of you guys may have an idea?
Greets Jens alias DV-JF
-
Thank you all...
Maybe I am not understanding properly, but in the template Access options you can check "Add Children" while leaving "Edit Pages" unchecked. I do this all the time to allow users to create new articles, but not edit the main article page.
This was the point I was searching for. I also want to mention, that it is necessary to give the subpage / article page a template with the rights for the editor to edit it.
Many greets, Jens. -
Hi all,
I wonder if it's possible to create a user / role for users witch is allowed to add subpages to a page with a specific template but is NOT allowed to edit the page itself.
For example: I want to create a user who can add new articles to a site with template "category". He mustn't be able to edit the page with template "category".
Is this possible?
Many greets, Jens alias JFDV.
-
Hi,
for a website witch is supposed to listen some events I'm trying to add the date-field from my "event-template" to the page URL so that the URL is something like this:
example.com/events/2014-02-14_title-of-event/
All single-events are children of the page "events"
I've tried
$pages->addHookAfter('Page::path', null, 'hookPagePath'); function hookPagePath(HookEvent $e) { $page = $e->object; if($page->template == 'article') $e->return = "/$page->startdate_$page->name/"; }
and the URL is rewritten correctly, but every time I try to reach this URL I get an 404 error. I've read this topic, but I think URL segments won't work for me, cause I try to work with an underscore.
Can you help?
-
I just tested and it seems to work fine at my end too. If you're comfortable in PHPMyAdmin you could delete the entry from the field_geo_address table. It would be great to figure out why it's not working for you. But if you need this quickly, it might be the simplest way for now.
Of course this would be the simplest way to get rid of it, but I wonder, why I can#t delete it the regular way.
When installing MapMarkerFieldtype I've had some problems, because PHP-allow_url_fopen and PHP-allow_url_include where switched off an the server. After activating them, it seemed to work for me, but I still get an errormessage, when I try to open the field settings.
Perhaps my saving problem is in relationship to the hassle while installing the field?!
-
The top save button has had some issues actually saving any changes in some web browsers on older versions of PW. Everything should be fixed in recent dev versions, but if you don't want to upgrade, try using the save button at the bottom of the page and see if that works.
Tried both: A different browser (Chrome and FF latest ver.) and both "Save" buttons ;( Nothing worked for me... I'm using PW Ver. 2.3 with teflon admintheme http://modules.processwire.com/modules/teflon/
Any other ideas?
-
-
no, not at the moment. But having wild cards would be great feature to have.
Yeah I agree
-
Hi,
is there a possibility to redirect or rewrite an old gallery with all its subpages to a single page. I relaunched a site using following URL structure, eg:
/scenario.php?ordner=gallery&datei=show&Gallery_ID=2&Unterkategorie=0 /scenario.php?ordner=gallery&datei=show&Gallery_ID=2&Image_ID_before=14&ZuStr= /scenario.php?ordner=gallery&datei=show_details&Gallery_ID=2&Image_ID=5643&Model_ID=&Unterkategorie_ID=&ZuStr=
Now I want to redirect all pages from the "Gallery_ID=2" to one single PW page e.g. example.com/gallery/people/
Is this possible with this module without creating a single redirect for every old page or how can I handle this task?
Greets!
-
Do you save with the top save button?
Yes, why do you ask? Is there another option?
-
Uncheck the box to the left of latitude, then delete the latitude and longitude (make them blank). Save. Following that it should return to the default/unset location specified in the field settings.
Hey Ryan,
thx for replying, but that way doesn't work for me ?!? After saving the old coordinates reappear and I can still see the map on frontend.
-
-
This is a blog (of sorts) for my father, with make-pretend postcards sent from Portugal. It is essentially a way for me to experiment with and learn a few techs/tools:
- css 3d transforms (and respective headaches, cross-browser issues, etc)
- The wonderful angularJS framework
- Yeoman (build system for js apps, with grunt + bower)
- Processwire, of course
Hey tiagoroldao,
your the only one who mentioned yeoman in the forum here yet. So here's my question to you:
How's your workflow with yeoman and Processwire? I would like to hear how you deal with it.
Many greets!
- 1
-
What's being described above is essentially ProcessWire's pages system, and repeaters aren't meant to replace creation of page structures or groups of different pages.
Hey Ryan, I agree with you.
Processwires page system would match perfectly, the only problem for the editors I see is, that the whole content witch is displayed on one page at the frontend site, would be fragmented into many child-pages without having the opportunity to edit and manage it on one single site.
Many greets, DV-JF alias Jens.
-
New french Processwire site
in Showcase
Posted
Hi Nicolas,
I really like this site. While browsing I've found two things to mention:
Here the text is really hard to read:
When switching to "medium-screen-size" there seems to be an error:
Before you may ask: I'm using this really great tool to inspect the mobile breakpoints: http://lab.maltewassermann.com/viewport-resizer/
Many greets, Jens alias DV-JF