fabjeck

Members
  • Content count

    11
  • Joined

  • Last visited

Community Reputation

1 Neutral

About fabjeck

  • Rank
    Jr. Member
  1. fabjeck

    Hello everyone. The website I'm currently working on, contains a "news-section", where the user/punlisher is able to write articles. In most cases the publisher is gonna add a image to the article. But when he doesn't, a default wallpaper, should be displayed. Now: My problem is that I'm struggling to get the default img, which is in an image folder under templates. if($article->image) { $image = $article->image->width(1000); } else { $image = templates->images->get('default_wallpaper.png'); /* of course it doesn't work like this, but that's what I want to achieve */ } $preview = $image->width(400); $thumb = $preview->url; $img = $image->url; }
  2. Hi @szabesz. Of course! I could have come up with it by myself. One little addition: I had to change the comparison operator from equal (==) to identical (===) because comparing an empty string to the value zero (for unchecked) gave back true. And that is finally the reason why i can set $limit to an empty string but not force...
  3. Hello community, In my code I have a function (see below) that finds the needed articles before they get rendered by another function. And depending on where I want this articles to be shown on the website I want to filter them by the checkbox "force" - all articles with force = unchecked or all articles with force = checked. function findArticles($limit, $force) { $selector = "template=article, sort=-published, limit=$limit, force=$force, " . trim($selector, ", "); $articles = pages($selector); return $articles; } The code above works fine, but now in one case I want to show all the articles, no matter if checked or not. If I call the function with $force equal to empty (" ") it only gives me back the articles that aren't checked. I could do it like that (see below) but it isn't ideal. Setting $limit to empty (" ") works so why not with the checked? function findArticles($limit, $force, $all) { if($all == true) { $selector = "template=article, sort=-published, limit=$limit, " . trim($selector, ", "); } else { $selector = "template=article, sort=-published, limit=$limit, force=$force, " . trim($selector, ", "); } $articles = pages($selector); return $articles; } As always, thanks for helping
  4. Hi all. Some days ago I migrated my website from local (xampp) to online. Everything works fine exept one thing. When i try to fill a field of the type "url" (with an external link) i get an 403 - forbidden message. Writting text in textfields , body etc. works. Now I don't know if the problem comes from processwire or the server itself... Did anybody have the same/similar troubles? Thanks for helping! cheers
  5. Hello all, all my body tags with cteditor create one empty paragraph before and one after the content that I have written. So then it looks like: <p></p> <p>My actual content</p> <p></p> In the field settings I checked the option "removing empty paragraphs" but than doesn't change anything. This Option propably only works for markup you create inside the body field. Thanks for your help. cheers UPDATE: Found the error myself. I tought that i had to give out the body inside a p-tag as its content. But because the body tag itself creates p-tags my "wrapping" p-tag was empty.
  6. fabjeck

    I had it like that, but missed a coma after the "sort" argument...but thanks for your help!
  7. fabjeck

    thank you @kongondo for the quick answer. $page->published works for me but with that method I can't sort the pages by date.
  8. fabjeck

    Hello everyone. I am trying to create a Lister like on the processwire demo page, where under the tab "Pages" you can directly go to "Skyscrapers". On all the tutorials I found on the internet Lister wasn't a core feature and you could create a new Lister on the module itself. Is it now a premium function under ListerPro or am I trying to do it the wrong way? Cheers
  9. fabjeck

    Hello Community On my website I have a newsfeed, where I want to display the datetime of when the article was published. I know there is a module called "ProcessWirePublishDate". But is it possible that it only returns the date without the time? How could I fix it. Thanks for helping
  10. fabjeck

    Thank you very much @Robin S! I always tried to do it with region() and render()...but this solution is surely better. I will try to implement it this evening or tomorrow.
  11. Hi all, I am new to PW and building up a website for a customer and have some problems with structuring my project: On my main.php file I have a main-tag where I wan't to echo the region called 'content'. But the problem is that the markup inside this wrapper should be variable.Example: I have a page where all the news previews are outputed like in a normal news app--> no additional markup is needed. But on "home" I want to have different sections with content --> <section> <div class="slider"> <!--here i want to have some filtered news articles--> </div> </section> <section> <div class="news"> <!--here i want to have some news articles but with another filter--> </div> </section> How can I realise that? It has to be like that for responsive purposes. Is it maybe possible to create and echo regions inside the "parent region"? Cheers and thank you for your help