Jump to content

felix

Members
  • Posts

    214
  • Joined

  • Last visited

  • Days Won

    8

Posts posted by felix

  1. We've been using vagrant quite a lot in the past. It's a good way of ensuring everyone working in a Team has the same Serversetup as close to the live System as it can get. It has some performance and complexity drawbacks though. Currently we've mostly switched back to "good ol localhost" for most projects

    • Like 1
  2. Hey marcus. It seems like there really is an issue which (most propably) is caused by a changed behaviour when doing object overloading since the 2.4 update (at least that's what marco said - I'm not that much of a "PHP Pro" :) ).

    We didn't noticed this yet due to the reasons already stated. There will presumably be a fix for this next week.

  3. I tested it with a fresh setup and got the same result you did. We're always using this module combined with TemplateTwigReplace so I wasn't aware that this happens when using it with "plain php" :). If you'd install TemplateTwigReplace and echo the variable using {{ bar }} everything would work as expected. But I'm sure not everyone likes using twig as much as we do. Also this shouldn't be a dependency. 

    I'll ask Marco about this tomorrow and keep you updated. 

  4. Hi Marcus,

    PHP 5.5 shouldn't be a problem. I'll hack together a working site-profile that you can download and check against your code today. I'm pretty sure both of us are just missing/overseeing something important. We're using this module in pretty large projects and didn't find any bugs yet. :)

  5. Wow. "As usual" this post was made at the right time. We're currently building two projects that need some advanced search mechanisms. We thought about using SolR or Elasticsearch. I would propably have gone with SolR as we've used it in other projects before. This module will make our decision a lot easier :D

  6. Hi marcus,

    greetings to berlin! ;)

    Well: This is sort of strange. Your examples seem to be absolutely correct.

    To debug let me ask you some questions regarding your setup:

    • Which PHP Version are you using?
    • Do you have any modules installed that might conflict with TemplateDataProviders (something that installs hooks before rendering templates)?
    • Have you tried setting some different variables (i.e. clearing the "foo" example and setting something else)? 

    Felix 

  7. Hey Marcus,

    as Marco is currently not available i'll try to answer your questions. Normally what you did should be correct.

    Your structure should now look like this:

    templates

    --- | dataproviders

    --- | ---HomePage.php

    home.php

    If this is the case you can try to debug if the dataprovider is loaded correctly. If you just place a "die('test')" inside it's populate method this should be the only output that is displayed on the homepage as the populat method is executed before rendering the actual template.

    If the template renders correctly instead of just displaying the text "test" there is a problem with loading the dataprovider. This (from my experience) is mostly the case if either the classname of the dataprovider is misspelled or (as stated above) there is a problem with a case sensitive filename.

    If this doesn't help just contact me here or via skype and we'll debug your problem together. 

    Best Regards

    Felix

  8. I'm with you soma: I "watched" both talks as i usually "watch" videos from conferences: Listen to them playing in the background and look at the video when there is something interesting to see on the slides (*doh*).

    Nevertheless: Nice talks from both of you. I know from my personal experience that it isn't as easy as it seems to give a talk even to a small group of people. You both did very well!

    • Like 1
  9. We've recently launched the website/blog for our new podcast: http://neuwaerts.fm/ (sorry folks: it's in german) which is of course powered by processwire.

    The podcast is mainly about marketing, social media and "changing things in your daily routines".

    From a technical point of view it's pretty much a small, standard blog (although not based on ryans blog-profile).

    Used Plugins:

    • Thumbnails
    • Modules Manager
    • Video Embed for Youtube
    • Template Twig replace
    • Template Data Providers
    • Like 5
  10. Hey totoff,

    thanks for the input. You're absolutly right with what you are saying. That's why we've already "been there, done that". We did a comparison and a live demo, Featurelistings and adressed all of their points. We even offered a contract to continue pw core & feature development if it's been discontinued for some reason. As I said: It's not that the customer doesn't like the system from a feature and usability point of view. But having a certain company size sometimes includes making sure there are some numbers you can rely on that save your back in case of "political" pressure. And that's what we are searching for to give him the needed security.

  11. Actually there isn't anything "special". The site will have to handle a pretty decent amount of traffic and there will be a lot of custom Code to connect the Website with various webservices. But that is even easier to achieve in pw than it would have been in typo3. It's just the Client that likes to have some sort of security apart from what we are telling him.

    • Like 1
  12. We recently won a pitch for a website of a larger organization that we hope will gain a lot of visits and interest (in our region). The specification book didn't force a CMS to be used but recommended using typo3 as the clients old website is already running with it.

    Of course(!) we are planning to build the website with processwire as it's our current CMS of choice (and because Typo3 is a pain in the a... ;) ). After presenting PW to the client's IT-Department and the internal ressources that will be creating content they are interested but still not convinced because there are few example showcases and experience reports that match their organization size (1k+ employeers).

    As a result we were asked to collect some Information on large scale processwire sites and the companys behind them. Plus (if possible) give them some contacts on organization side who they can talk to about experiences (everyday work, performance, security).

    So: If any of you can help us with that (examples, contacts) your help will be greatly appreciated. I'm sure there will be a lot of interest for PW as a system when the website will be built with it.

    • Like 5
  13. We've just implemented a voting functionality for a site which is currently under heavy development (i'll post it here, soon).

    Users can send in Videos/Photos and win prizes. Every entry can be voted.

    The way we've done it is like this:

    - Users can vote via FB and Twitter without any further authentication (social network id, origin + timestamp stored in db)

    - Users can Vote with their E-Mail Adresses. To avoid fake votes they can vote for as much entrys as they want but their votes aren't counted until they click a link in an opt-in mail. After the adress is validated they are handled the same as twitter/fb users. E-Mails Adresses are Checked against a list of disposable/trash-mail services before storing them (E-Mail Users got a seperate table with a is_confirmed flag)

    We've also discussed using a service like https://www.rafflecopter.com/ or http://www.voycer.biz/en to use their (very cool) social voting features (tweet to win...) but most of them are either created explicitly for raffles that are based on a single question/item or just support facebook as sign-on mechanism.

    • Like 6
  14. Hi Ryan,

    I'm trying to import a list of retailer locations into processwire using your module.

    The retailer stores all got the same name which contains an "umlaut" (ö). 

    In the options I chose "Make the name unique and import new page". The Records are imported correctly but the title is cut after the umlaut (every page title is "xxx" instead of "xxxöyyy").

    Do you have any suggestions how to fix this?

    • Like 1
  15. Hey SteveB, Hey Manaus,

    as Marco can't answer currently I'll try to answer your questions as far as I can.

    @SteveB the answer is: No. As you've mentioned you can't just use PHP in Template Twig Replace. It is designed to replace the whole rendering Process and expects the input to be twig compatible. You could use Twig filters to achieve PHP execution though.

    The way we (Marco works at the same company I do) use Twig Replace & Data Providers is somewhat similar to the delegate approach. We use some basic "wrapper" Templates and extend them (using blocks) with template based code.

    Here is an example we actually use in a blog page from an actual project:

    Base Template (_base_template.twig in /templates) which is extended later on (every %block acts as a placeholder which can be filled with stuff from templates or chunks):

    <!DOCTYPE html>
    <!--[if lt IE 9 ]><html class="no-js lt-ie9" lang="de"><![endif]-->
    <!--[if IE 9 ]><html class="no-js ie9" lang="de"><![endif]-->
    <!--[if !(IE)]><!--><html class="no-js modern" lang="de"><!--<![endif]-->
    <html lang="de" xmlns:fb="http://ogp.me/ns/fb#">
        <head>
            {% include 'includes/htmlhead.twig' %}
            {% block htmlhead %} {% endblock htmlhead %}
        </head>
        <body>
            <div class="wrapper">
                {% include 'includes/header.twig' %}
                {% block stage %}{% endblock stage %}
                <main class="main">
                    {% block mainContent %}{% endblock mainContent %}
                </main>
                {% include 'includes/footer.twig' %}
            </div>
            {% include 'includes/javascript.twig' %}
            {% block beforebody %} {% endblock beforebody %}
        </body>
    </html>
    

    Blog Page (blog.twig in /templates) which displays an overview of the last articles:

    {% extends '_base-template.twig' %}
    
    {% block stage %}
        <div class="stage row">
            <img class="stage__background" src="{{ config.urls.root }}dummy-data/stage_default.jpg">
            <div class="stage__inner large-12 large-offset-2 columns">
                <h1 class="stage__headline stage__headline--default headline">xxx</h1>
            </div>
        </div>
    {% endblock %}
    
    {%  block mainContent %}
        <main class="article row" role="main">
            <div class="large-offset-2 large-10 columns">
    
                {% for article in articles %}
                    {{ page.renderChunk('includes/blogpost_preview.twig',article,'blog') }}
                {% endfor %}
    
                {{ page.renderChunk('includes/pager.twig',articles) }}
    
            </div>
            {% include 'includes/sidebar.twig' %}
            
    
        </main>
    
    
    
    {% endblock mainContent%}
    

    The Coressponding "DataProvider"/Controller (BlogPage.php in /templates/dataproviders):

    <?php
    
    /**
     * Class definition of BlogPage
     *
     * @version 1.0.2
     * @copyright Copyright (c) 2013, neuwaerts GmbH
     * @filesource
     */
    
    /**
     * Class BlogPage
     */
    class BlogPage extends \nw\DataProviders\PageDataProvider {
    
        public function populate() {
    
            // load articles
            $today = date('Y-m-d');
            $this->articles = wire('pages')->find('template=blog_article, blog_articledate<=' . $today . ', sort=-date, limit=5');
            $pages = wire('pages');
            $this->categories = $pages->get('/blog/kategorien/')->children();
    		$this->authors = $pages->get('/blog/autoren/')->children();
        }
    }
    

    And (just to make it complete and show some more twig stuff) here is the chunk for displaying the blog post previews that is included in the template. The chunk gets the article as a param and has it's own controller where you can place logic (i.e. to find related articles), too. 

    <article class="article__preview clearfix">
    	<div class="article__content">
    		<header class="article__header clearfix">
    			<h2 class="article__headline"><a href="{{article.url}}">{{ article.headline ?: article.title }}</a></h2>
    			<div class="article__meta">
    				{% for author in article.blog_author %}
    					{% if loop.length > 1 %}
    					<span class="meta__author"><img class="article__avatar" src="{{ author.blog_authorimage.size(20,20).url }}" alt="{{ author }}">{{ author.title }}</span>,
    					{% endif %}
    					{% if loop.last %}
    						<span class="meta__author"><img class="article__avatar" src="{{ author.blog_authorimage.size(20,20).url }}" alt="{{ author }}">{{ author.title }}</span>
    					{% endif %}
    				{% endfor %}
    					 | <time datetime="{{ article.blog_articledate|date('Y-d-m', config.timezone) }} ">{{ article.blog_articledate|date('d. F Y', config.timezone) }}</time>
    			</div>
    		</header>
    		{% if includeTemplate == 'blog' %}
    				{% if article.blog_keyvisualsize == 'small' %}
    					{% set size = 280 %}
    				{% else  %}
    					{% set size = 755 %}
    				{% endif %}
    				{% if article.blog_articlekeyvisual %}<img src="{{article.blog_articlekeyvisual.width(size).url}}" alt="{{article.blog_articlekeyvisual.description}}" class="article__keyvisual {{article.blog_keyvisualsize}}">{% endif %}
    				<div class="article__text">
    					{% if article.body|length > 350 %}
    						{{ article.body[:350] }}...
    					{% else %}
    							{{ article.body }}
    					{% endif %}
    				</div>
    		{% endif %}
    		<div class="article__category">
    			{% for category in article.blog_category %}
    				{% if loop.length > 1 %}
    				{{ category.title }}, 
    				{% endif %}
    				{% if loop.last %}
    						<a class="category__link" href="{{ config.urls.root }}blog/kategorien/{{category.name}}">{{ category.title }}</a>
    				{% endif %}
    			{% endfor %}
    			<div class="article__read-more right">
    				<a class="read-more" href="{{article.url}}">Artikel lesen</a>
    			</div>
    		</div>
    	</div>
    </article>
    

    So we're basically splitting everything in includes (DRY), template specific stuff and Controllers. That's the way we believe is the "cleanest" and best maintainable. If you'd like to output some default stuff (i.e. headline and body) you're free to add it to the base template and just overwrite the block that they are in on demand.

    @Manaus: You don't HAVE to rename everything into .twig - but you CAN. If you like to do this you'll have to set this explicitly in site/config.php: $config->templateExtension = 'twig';

    Enclosing everything in a <?php is not required (in fact it will output this as plaintext: <?php).

    • Like 1
  16. Thanks apeisa!

    All the content is actually linkable. Every content has it's own "physical" deeplink which is loaded via ajax on click. So if javascript is inactive the link will open a normal content page. The second benefit (apart from the site beeing accessible without js and less overhead) is SEO: All contents can be indexed individually.

    Take this link for example: http://einfach-lebenswert.net/naeher-dran-leben/erzeuger-und-maerkte/ - If you open it you'll be redirected to the homepage (this was a customer request :/) if you've got JS enabled. Otherwise you'll be seeing just a normal details page of the article.

    • Like 1
×
×
  • Create New...