Jump to content

horst

PW-Moderators
  • Posts

    4,077
  • Joined

  • Last visited

  • Days Won

    87

Everything posted by horst

  1. Hi jacksprat, GD is not working! because the GD-function imagecreatefromjpeg isn't defined / available in server setup. Please check / enable GD-library for PHP.
  2. Hi Zahari, great there is some progress. Lets's look to the two issues now. And I once again want to say that I haven't used that profile, and I don't know it, - so if there is someone reading who knows it, come in and shed some light second one first: As the original code is written to render the navbar fast and straight forward, we have to hack in and rearrange parts and also first have to buffer the (optional) childrens output. This very fast can become cumbersome. Here is a version that you may try. I haven't tried it and I don't know if it works. If I understand the original code and assume it's relations right, it should work, but I don't know. function renderTopNav(PageArray $items, array $options = array(), $level = 0) { $defaults = array( 'tree' => 2, // number of levels it should recurse into the tree 'dividers' => true, 'repeat' => false, // whether to repeat items with children as first item in their children nav ); $options = array_merge($defaults, $options); $divider = $options['dividers'] ? "<li class='divider'></li>" : ""; $page = wire('page'); $out = ''; foreach($items as $item) { if($item->addtonavbar == 0) { continue; // should be excluded, so we skip and went to the next } $numChildren = $item->numChildren(true); if($level+1 > $options['tree'] || $item->id == 1) $numChildren = 0; $buffer = ''; // we need to buffer all children output if($numChildren) { $buffer2 = renderTopNav($item->children, $options, $level+1); if(strlen(trim($buffer2))>0) { $buffer = "<ul class='dropdown'>"; if($options['repeat']) $buffer .= "$divider<li><a href='$item->url'>$item->title</a></li>"; $buffer .= $buffer2; $buffer .= "</ul>"; } } $class = ''; if($numChildren && strlen($buffer)>0) $class .= "has-dropdown "; // parent gets dropdown-triangle if it has numchildren and the childrens-buffer isn't empty if($page->id == $item->id) $class .= "current "; if(($item->id > 1 && $page->parents->has($item)) || $page->id == $item->id) $class .= "active "; if($class) $class = " class='" . trim($class) . "'"; $out .= "$divider<li$class><a href='$item->url'>$item->title</a>"; $out .= $buffer; // buffer is an empty string or contains complete ul-list of children $out .= "</li>"; } return $out; } I think it is logical if you don't show a parent, you cannot show it's children. They belong together.
  3. Hi Zahari, welcome to the forums. Great you have found PW ;-) I assume you know how to add a checkbox-field to the templates (if not, please ask here again!) For example you may call this field "excludeFromTopnav" and after that you have to check in the foreach-loop in the function if the current item (what comes from an PageArray, so it is a $page) have this field checked or not: (Line 16) function renderTopNav(PageArray $items, array $options = array(), $level = 0) { $defaults = array( 'tree' => 2, // number of levels it should recurse into the tree 'dividers' => true, 'repeat' => false, // whether to repeat items with children as first item in their children nav ); $options = array_merge($defaults, $options); $divider = $options['dividers'] ? "<li class='divider'></li>" : ""; $page = wire('page'); $out = ''; foreach($items as $item) { if($item->excludeFromTopnav == 1) { continue; // should be excluded, so we skip and went to the next } $numChildren = $item->numChildren(true); if($level+1 > $options['tree'] || $item->id == 1) $numChildren = 0; $class = ''; if($numChildren) $class .= "has-dropdown "; if($page->id == $item->id) $class .= "current "; if(($item->id > 1 && $page->parents->has($item)) || $page->id == $item->id) $class .= "active "; if($class) $class = " class='" . trim($class) . "'"; $out .= "$divider<li$class><a href='$item->url'>$item->title</a>"; if($numChildren) { $out .= "<ul class='dropdown'>"; if($options['repeat']) $out .= "$divider<li><a href='$item->url'>$item->title</a></li>"; $out .= renderTopNav($item->children, $options, $level+1); $out .= "</ul>"; } $out .= "</li>"; } return $out; } So, not tested and I also haven't worked with the foundation profile, but it should work. Otherwise please come back here.
  4. https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/LanguageFunctions.php#L39 I think you can only split your text so that it doesn't contain HTML-tags. Also it isn't possible to write a wrapper function that does the splitting + translation + concatenation for you, because the translation-texts must be available in static form in code,
  5. Many thanks! Their site is currently not accessible for me, but I have found some good tutorial over its use. I will try again later.
  6. Hi, I have shown PW to a collegue of mine and now he is thinking about to use it for his website. Actually he sorts his needs, and there is one question: Has anybody already written (short) posts / texts in PW and pushed them to facebooks timeline? He don't like "work" in FB and pull that stuff into PW (what is already described here in forums). He would like it the other way round.
  7. Yeah, I think finally that hits the nail! Well, now there's more time for sudoku
  8. I think that must be done with ajax (so we are in DevTalk) with something like: while(onMouseOver('likeButton')) { hesitationCounter++; }
  9. LOL, no, it's just a try and error. I want to have members with more likes than posts counted up, but also want to honor much posts. But it doesn't do it with a simple linear ratio, because a member with only 1 or 2 posts and 15 likes beats all, also ryan with 3000 likes and 6000 posts. So I have tried to build a relation between the ratio and amount of the two parts. <german>Getreu dem Motto: "Trau keiner Statistik, es sei denn, du hast sie selbst gefälscht!"</german> <hopefully-correct-translation>Keeping with the motto: "Trust no statistics, unless you yourself have forged it!"</hopefully-correct-translation> YEP! no, it isn't that simple. oh, - you never have seen one of my sudokos I once only have played Gobang, a simple form of it. first point +1 second one: this would it make much more complex. And of course, than we also should take the profile-views into account? - or the posts per thread (in relation to the thread.length)?
  10. -------------------------------------------------------------------------------------------------------------------- EDIT (08.01.2014): finally a sortable Table is here: http://ranking.pw.nogajski.de/ (more info is here: http://processwire.com/talk/topic/5290-topposters-oldcode-more/) -------------------------------------------------------------------------------------------------------------------- Hi, I have not have a sudoku today, so I tried to create a Top-Posters-List that not rely only on the count of posts. But the line 41, where the ratio is calculated, needs to be corrected. If someone have a better math for it, please post it. <?php //---------------------------------------------------------------- GLOBAL CONFIG define('PW_MEMBERS_URL', 'http://processwire.com/talk/members/?sort_key=posts&sort_order=desc&max_results=60'); define('PW_MEMBERSLIST_PATTERN_1', "/<ul class='ipsMemberList'>(.*?)<script type='text\/javascript'>/msi"); define('PW_MEMBERSLIST_PATTERN_2', "/<li id='member_id_(.*?)'.*?<img src='(.*?)'.*?<\/ul>.*?<h3.*?<strong>(.*?)<\/strong>.*?<span class='number'>(.*?)<\/span>.*?·(.*?)post.*?<\/li>/msi"); //-------------------------------------------------------------- EXECUTABLE CODE $members = array(); $urls = array( PW_MEMBERS_URL, PW_MEMBERS_URL . '&st=60', PW_MEMBERS_URL . '&st=120', PW_MEMBERS_URL . '&st=180', PW_MEMBERS_URL . '&st=240' ); foreach($urls as $url) { $buffer = preg_match(PW_MEMBERSLIST_PATTERN_1, file_get_contents($url), $matches)===1 ? $matches[1] : null; if(is_null($buffer)) { echo "Something has going wrong with '$url'!"; exit(1); } if(60===preg_match_all("/<li id='member_id_(.*?)'.*?<img src='(.*?)'.*?<\/ul>.*?<h3.*?<strong>(.*?)<\/strong>.*?<span class='number'>(.*?)<\/span>.*?·(.*?)post.*?<\/li>/msi", $buffer, $temps, PREG_SET_ORDER)) { foreach($temps as $temp) { $likes = intval($temp[4]); $posts = intval(str_replace(',','', trim($temp[5]))); $member = array( 'id' => intval($temp[1]), 'name' => strip_tags($temp[3]), 'profile' => $temp[3], 'imgsrc' => $temp[2], 'likes' => $likes, 'posts' => $posts ); if(0==$likes) { $member['ratio'] = 0; // intval( $posts / 50 ); } else { $member['ratio'] = intval((($likes / $posts) * 100) * ($likes)) + intval($posts / 5); } $members[] = $member; } } } $members = hn_array_sort($members, array('ratio','likes','posts'), true, true); // the TOP 100 echo "<table border='0' cellpadding='0' cellspacing='5'>\n<tr><th>ratio</th><th>name</th><th>likes</th><th>posts</th></tr>\n"; for($i=0;$i<100;$i++) { $a = array_shift($members); echo "<tr><td>{$a['ratio']}</td><td>{$a['name']}</td><td>{$a['likes']}</td><td>{$a['posts']}</td></tr>\n"; } echo "</table>\n"; exit(0); //-------------------------------------------------------------------- FUNCTIONS /** Sorts the values of a given multidimensional Array in hirarchical order of the sortlist * @shortdesc USAGE: $SORTED_Array = hn_array_sort($orig_array, array('field3','field1','field2')); **/ function hn_array_sort($a, $sl, $intvals=false, $descending=false, $casesensitive=true) { $GLOBALS['__HN_SORTVALUE_LIST_DESCENDING__'] = $descending; $GLOBALS['__HN_SORTVALUE_LIST_CASESENSITIVE__'] = $casesensitive; $GLOBALS['__HN_SORTVALUE_LIST__'] = $sl; if($intvals===true) { usort($a, 'hn_cmp_Values_intvals'); } else { usort($a, 'hn_cmp_Values_strvals'); } return $a; } // Callback for hn_array_sort() function hn_cmp_Values_strvals($a, $b) { foreach($GLOBALS['__HN_SORTVALUE_LIST__'] as $f) { $strc = $GLOBALS['__HN_SORTVALUE_LIST_CASESENSITIVE__']===true ? strcmp($a[$f],$b[$f]) : strcasecmp($a[$f],$b[$f]); if($strc != 0) { if($GLOBALS['__HN_SORTVALUE_LIST_DESCENDING__']===true) { return $strc * (-1); } return $strc; } } return 0; } // Callback for hn_array_sort() function hn_cmp_Values_intvals($a, $b) { foreach($GLOBALS['__HN_SORTVALUE_LIST__'] as $f) { if(intval($a[$f])===intval($b[$f])) { $intc = 0; } elseif(intval($a[$f])>intval($b[$f])) { $intc = $GLOBALS['__HN_SORTVALUE_LIST_DESCENDING__']===true ? -1 : 1; } else { $intc = $GLOBALS['__HN_SORTVALUE_LIST_DESCENDING__']===true ? 1 : -1; } if($intc !== 0) return $intc; } return 0; } EDIT: replaced the Line 41 with a new more suitable formula
  11. Here is code from Ryan in a post of this thread: // Run photo upload foreach($files as $filename) { $pathname = $upload_path . $filename; $np->contact_photo->add($pathname); $np->message("Added file: $filename"); unlink($pathname); // This deletes the uploaded file after it was added to the new page ($np) } unlink(); If you work with another code, you also add the files to the page. After that you have to unlink('the temp-file');
  12. Without knowing how, I can say yes. Because Somas Modules Manager exists and it knows all of my installed Modules. (Sorry for beeing not much of help)
  13. good and clear design! "Buchungsanfrage" isn't completly implemented? When trying I don't get a list of rooms or calendars.
  14. No sorry, I don't know it, - but I once again recommend to post this into the support board of the module. This way there is a big chance that the modules author read it and can respond to it. (thats why the support board exists!)
  15. Hi seedle, welcome to the forums. I think you should post that to the support board of the module. This way there is a big chance that the modules author read it and can respond to it. I haven't integrated third party programms into PW myself, but I think it could be more work to do than to get the discussion module running. But I'm not sure on this.
  16. This definetly sounds to some sort of filesystem permission. Have you turned debug on and there are error-logs? Do you have a look into Browser-Console (JS, Network), because upload is ajax-based. sounds like filesystem permission too! (Session-files) You also need to check Apache logs. Has the server software changed 7 days ago? Or if it is a hosted account, was the account moved? ---- Also, don't know if it is relevant here, you have in PHP-settings upload_max_filesize 2M and post_max_size 8M, - not that much.
  17. You can use scripts in commandline mode or in HTTP environment that include the pw index.php like this for example: // the absolute path or relative path to processwires index.php $PATH2PWindex = dirname(__FILE__).'/index.php'; // $username and $pass to a superuser $PWuser = ''; $PWpass = ''; // ... require_once($PATH2PWindex); wire('session')->login($PWuser,$PWpass); if(!wire('user')->active || !wire('user')->hasRole('superuser')) { echo "\n\nERROR: Incorrect UserLogin!\n\nScript stop now!\n"; exit(1); } after that you are logged in as superuser and can do all API stuff you like. I use this above as external CLI-Script and ask for credentials in shell window. You have to access the API via wire('pages'), wire('session'), etc instead of $pages or $session. http://processwire.com/api/include/
  18. Hhm, yep. I want to note that the PW-installation routine doesn't check that. I always use(d) password without numbers
  19. Which PHP Version is on the new Server?
  20. I have the same behave when uploading from local with PHP 5.3.12 to online shared host with PHP 5.2.12 But I use the 'forgot your password?' link once and then everything works fine. I can use the Password recovery with the account name or the email-address. PHP 5.3.12 -> 5.2.12 MySQL 5.5.13 -> 5.1.66
  21. horst

    My new Portfolio

    Hi Matthew, many thanks for the reply and your thoughts! This is very helpful. These thoughts are right, but the slider on the homepage, or better: the complete homepage only was created because I was a bit scared about slow loading of the portfolio page. But the homepage doesn't provide new or other content than that from the portfolio. So, in the next round (5), I skip the homepage and focus on the images loading first. Yeah, I need a concept here! Actually there isn't one, only fragments of different approaches that don't fit together. Yes, this should be. What do you mean with "in key places throughout the site"? There are some articles under infos that explain some parts of my work. Actually only in german, but I think I let translate (some of) them. Also I want add more to it. I'm not sure if I should put all under that point? and also if "infos" is the right name for it? Anyway, there is some more work to do before official (re)launch.
  22. horst

    My new Portfolio

    @soma: thank you! Oh, I see. I have changed the settings for Swipe and have not tested on mobile after that. Normally Swipe displays the images nearly fullscreen, but on desktop I don't want that. Therefor I have hacked it at several points. I think I have to change it once more so that the hacks depend on the setting of var isMobile. I do not use the min size plugin together with the ImageManager. I use it on info pages imagesfields only, not in the portfolio where I use the ImageManager. Actually I only select one out of three sizes, depending on the report of the ajax script that sends viewport dimensions (initial and on resize). Here I stuck a bit, there are some thoughts but not very clear. Maybe I have found an interesting script what I want to analyze and try to combine with the Swipe somehow: http://responsiveimg.com/ But there are other options too.
  23. horst

    My new Portfolio

    Many thanks for your reply. the main menu: I'm unsure, maybe, may not, but many thanks for saying it clear! EDIT: I have deleted the margins between them and have added small borders. Maybe thats better. loader gif: solved! the arrow keys: the original behave was as you say, but I was confused all the time that way and therefor I have switched it.
  24. horst

    My new Portfolio

    Hi kongondo, many thanks for the feedback. That's right, because there is no english version available. But I don't want to hide all entries that are not available in english. Therefor I display a (only in german) under all those entries in the overview. This definitely should set to the current selected language, but is broken. Thanks for finding that!
  25. horst

    My new Portfolio

    @arjen: many thanks for the warm words Yes, I have thought about starting directly with the portfolio page, but was a bit scared because the heavy load on small bandwith. But I will re-think it! loading image fixed, thanks!
×
×
  • Create New...