Jump to content

Luis

Members
  • Posts

    295
  • Joined

  • Last visited

  • Days Won

    5

Posts posted by Luis

  1. I´m building a Markup Patternlab for my company to make it easy for our Devs and Graphic Designers to speak about the same elements and force them to produce reusable code. 

    This is a little side project of mine because i have to manage some freelance designers, devs and our inhouse designers and devs. 

    So this Patternlab is also serving as corporate styleguide once finished. 

    If im allowed I will publish the whole App for the comm. 

    Have a look:

    post-782-0-96298100-1448891583_thumb.jpgpost-782-0-89892500-1448891591_thumb.jpgpost-782-0-75029900-1448891598_thumb.jpg

    • Like 14
  2. Hey Guys,

    sorry for not responding or being active in any PW related topic for some time now. 

    First of all, yes I closed the shop and shut down my servers.

    I had some major trouble in the past related to my personal situation which made it impossible to work on my projects or to maintain them.

    Active development of the office suite would not continue, sorry for that. 

    During the last 12 months I changed my work live completly, I am now hired as Product Manager in a company and dont do freelancing stuff anymore. 

    I would overthink your wish to make the suite OS and share my decision on this the next few days with u if there is still interest in it, just let me know.

    :)

    Luis 

    • Like 10
  3. If you use jQuery, you could try a little workaround to display your images. 

    Not a very elegant way, but should work for small projects.

    I started with a little php function to get my newsposts and generate the markup:

    function getNewsfeed(){
      $curl = curl_init();
      curl_setopt_array($curl, array(
        CURLOPT_RETURNTRANSFER => 1,
        CURLOPT_URL => 'http://example.com/service-pages/?template=news&sort=-modified&limit=5'
      ));
      $result = curl_exec($curl);
      curl_close($curl);
      $data = '';
      $result = json_decode($result, true);
      if($result){
        foreach($result[matches] as $news){
          $data .='<div class="js-newsfeedentry s-newsfeedentry">';
          $data .='<h3>'.$news[title].'<small class="pull-right text-muted" style="padding-top:5px">Posted : '.date("d.m.Y - H:i",$news[created]).'</small></h3>';
          $data .= $news[text];
          $data .='<hr />';
          $data .='</div>';
        }
      }
      return $data;
    }
    

    as you can see, I wrap the entire newspost into a div with the class "js-newsfeed".

    Now we iterate over all images inside this div and manipulate the img src, to match the correct url from the web-service.

    Inside our document ready function we grab all news images and correct the src:

     /* fix urls for newsfeed img */
      var newsfeedimg = $('.js-newsfeed img');
      newsfeedimg.each(function(){
        var newimgsrc = 'http://example.com'+$(this).attr('src');
        $(this).attr('src',newimgsrc);
      });
    

    et voila, working images. 

    Remember that this isn´t a very good solution because you iterate over every image in your newspost via JavaScript and you shouldn´t do this on a project with many images. 

    • Like 1
  4. I didn´t choose Anttis module because I need an own database for each site, even if they share the same modules and the same templates. Every site has his own user base and differs completely in terms of data and data handling.

    Just to clarify:

    Mothership Site -> own database - registration form - handles clients and submissions - connects to subsites via one user

       -- created subsites -> own database - own users - communicates with mothership 

    I wrote a little script which unzip a site profile, creates the client specific database and writes his config.php. 

    Every module I place into my modules folder would be installed automatically on every subsite if got a specific prefix. 

    I could imagine that a strong support for multisite setups would help to improve or even make some nice ideas possible.

    • Like 2
  5. Which browser do you use? 

    Source in Chrome looks good, the only thing I could imagine is that you see the network response which could only be something like you posted because it just contains the markup of $page->body.

    The whole markup is already there because you just replace the markup inside your bodycopy via javascript.  

    • Like 1
  6. Meh works as intendet. 

    The problem is, the ajax call replaces the html content of div#bodycopy. If you take look into your footer,inc you could find a foreach iterating through the page children creating the links you are missing. 

    They wont be rendered in the ajax response because they are not part of $page->body. 

    To solve your issue you have to change the markup in your footer.inc to something like this:

                        </div><!--/bodycopy-->
    
    ?php 
    
    				// Output navigation for any children below the bodycopy.
    				// This navigation cycles through the page's children and prints
    				// a link and summary: 
    
    				if($page->numChildren) {
    
    					echo "<ul class='nav'>";
    
    					foreach($page->children as $child) {
    						echo "<li><p><a href='{$child->url}'>{$child->title}</a><br /><span class='summary'>{$child->summary}</span></p></li>"; 
    					}
    
    					echo "</ul>";
    				}
    
    				?>			
    
    		</div><!--/container-->
    
    	</div><!--/content-->
    

    This needs some changes in your css to regain the original look and feel.

    EDIT:

    I had a brainfuck :D

    Do something like this, edit the javascript in head to

    <script type="text/javascript">
        $(document).ready(function() {
            $("#topnav a").click(function() {
    
                $("#topnav a.on").removeClass('on'); // unhighlight selected nav item...
                $(this).addClass('on'); // ...and highlight new nav item
                $("#bodyContent").html("<p>Loading...</p>");
                
                $.get($(this).attr('href'), function(data) {
                    $("#bodyContent").html(data);
                });
    
                return false;
            });
        });
    </script>
    

    now edit home.php and basic-page.php like this:

    <?php include("./head.inc"); ?>
    
    <div id="bodyContent"><?= $page->body ?></div>
    
    <?php include("./foot.inc"); ?>
    
  7. Howdie,

    my wish is to get more controll over a multisite-setup in one place, like a main admin on which I could communicate with all connected pages out of the box.

    For the moment I end up in a setup with a global modules and global templates folder. Every Site has a news section which communicates with the main site via the 'Pages Web Service' 

    But connecting to the multisite users/data out of the box would be a great addition.

    • Like 2
  8. Sorry nothing to help you with your language problems (I didnt setup PW with multi lang so far)

    But looking to your code in your first try:

    <form action="" method="post">
      <input type="text" name="taal" value="nl" style="display:none;">
      <input type="image" src="../site/templates/img/vlag_nl.png" name="submit" /> 
    </form>
    

    to send a hidden value you better should use:

    <input type="hidden" name="your_field" value="your_value" >
    

    The next thing, if you send only one Variable to get some new content, you could use an simple <a> like this:

    <a href="<?= $page->url ?>?my_var=my_value">Click me</a>
    

    This would output a url like this: 'my_site/?my_var=my_value' 

    As you could see all after ? is a so called $_GET variable, to create more Vars you just have to add them linke this:

    <a href="<?= $page->url ?>?my_var=my_value&new_var=new_val">Click me</a>
    

    Next is your missing input validation. If you ever process values you could get from users, sanitize them. 

    You could do this via the PW built-in system called $sanitizer.

    But before you do this, try to use the PW GET and POST functions instead of the PHP global vars $_GET and $_POST

    The PW way: $input->post->var_name and $input->get->var_name

    Example: 

    <form method="post" action="./">
      <input type="text" name="content" />
      <input type="submit" value="Send"
    </form>
    
    <?php if($input->post->content): ?>
    
      <p><?= $sanitizer->text($input->get->content) ?></p>
    
    <?php endif ?>
    
  9. The next bit found. 

    After calling a page, a script on top checks if the $user is allowed to do this or that action like so:

    if(!$project->staff->has($user)){
        header('Location: '.$pages->get(1)->url);
        die();
      }
    

    and now $user->userimage->url is available.

    @pete: no i`m not iterating through my users :) 

    I just want to access the userimage from this user, who is actually accessing the page. 

    So, You are looking into your profile and you get your userimage. 

  10. After playing Sherlock Holmes again, the riddle grows.

    I placed <?= $user->userimage->url ?> in various places inside my controller.php to find out under which circumstances the url method grabs the appropiate image file.

    After placing it right before the closing body tag, it gives me the right file. Now I figured out that after doing this right before:

    <?php foreach($users as $member): ?>
      <?php if($member->hasRole('projectmanager')): ?>
        <option value="<?= $member->id  ?>"><?= $member->membername ?></option>
      <?php endif ?>
    <?php endforeach ?>
    

    the $user->userimage is present. 

  11. Ok, this is the request made by $image->url 

    41/
    /projectplaner/clientspaces/site-admin/assets/files
    GET
    403
    Forbidden
    

    and this is the request made by <?= $config->urls->files . $user->id ?>/<?= $user->userimage ?>

    koala.jpg
    /projectplaner/clientspaces/site-admin/assets/files/41
    GET
    304
    Not Modified
    

    Does PW just try to get the folder by accident, or is this request blocked directly on the folder?

×
×
  • Create New...