Jump to content

nfil

Members
  • Posts

    138
  • Joined

  • Last visited

Everything posted by nfil

  1. Hi Ryan, yes the Setup > Fields > Add New fields. Can only see the required name field message and a blank screen underneath it. Tested it on multiple browsers. I have these modules installed, yet I had multi language enabled before, but not at the moment. Map Markup (Google Maps) 1.0.1 Markup Simple Navigation 1.3.3 Markup Sitemap XML 1.0.9 Import Pages from CSV 1.0.4 HiddenAdminPages 1.0.0 Clean Empty Page File Dirs 0.0.3 Batcher 1.0.4 Pages2Pdf 1.1.1 Forms TinyMCE (updated) I will do some more tests this weekend. Thanks. p.s. I also tested the upgrade module and no errors there too, all the modules were updated and compatible.
  2. hi. After upgrading from 2.4.5 to 2.5.3 or .4 I cannot create new fields I always see the msg Field 'name' is required No input fields just the message. reverting the folder wire to 2.4.5 I am able to create the new fields in the backend. Tested with php 5.4.13 and 5.5.0 and checked the few modules installed batcher etc, and they seem to be compatible and the latest version was installed, no info in the error log too.
  3. Hello wanze. I have a datetime field in my page with the Date/Time Output Format Code j/n/y PW outputs the formatted date, yet Pages2Pdf will not render the j/n/y format. Have you tried creating a pdf with a datetime field? Or am I doing something wrong. Thanks. update: I get different results, this was probably due to PW dev 2.4.5 I tested your module with PW 2.5 and seems to be fine.
  4. Hello wanze in the second example I was writing it on a tablet and some code was lost. It's a over complicated snippet by a newbie like me to check if a field is empty than render another, also checking if both of these fields are higher or equal to 500000 // image for output $visalogo = $pages->get("/")->logo_eurovisa; // if visavalue_b field is not populated it will show visavalue_a $visavalue_a = $page->price_a; $visavalue_b = $page->price_b; // value is populated and greater than if(empty($visavalue_b)) { $va = $visavalue_a>=500000; if ($va) echo "<img src=\"{$visalogo->url}\" width=\"300\" height=\"176\" />"; } $vb = $visavalue_b>=500000; if ($vb) { echo "<img src=\"{$visalogo->url}\" width=\"300\" height=\"176\" />"; }
  5. It should be something like this, count is for numberOfimagesChildren etc but I'm a newbie. // image for output $visalogo = $pages->get("/")->logo_eurovisa; // if visavalue_b field is not populated it will show visavalue_a $visavalue_a = $page->price_a; $visavalue_b = $page->price_b; // value is populated and greater than if(empty($visavalue_b)) { $va = $visavalue_a>=500000; if ($va) echo ""; } $vb = $visavalue_b>=500000; if ($vb) { echo ""; }Sorry for being a bit off topic.
  6. I've this image that is printed to the pdf if the value of the field is filled in the backend and its above 500000 but there are two variables, if one is not populated it will go to the next condition and print the value. How do I go about this one? Thanks. // image for output $visalogo = $pages->get("/")->logo_eurovisa; // if visavalue_b field is not populated it will show visavalue_a $visavalue_a = $page->price_a; $visavalue_b = $page->price_b; $count = "count()>1"; // $visavalue_b is populated now check if it is greater than 500000 if ($visavalue_b->($count)>=500000) { echo "<img src=\"{$visalogo->url}\" width=\"300\" height=\"176\" />"; } else { if ($visavalue_a>=500000); { echo "<img src=\"{$visalogo->url}\" width=\"300\" height=\"176\" />"; } }
  7. After resting a bit and reading this carefully. it's all here: https://github.com/ryancramerdesign/SkyscrapersProfile/blob/master/site/templates/includes/search_form.php https://github.com/ryancramerdesign/SkyscrapersProfile/blob/master/site/templates/search.php Thanks Adrian
  8. Hello adrian. I'am learning php but I know the .= operator will concatenate the selector variable. lots of tangled code erased---
  9. yes adrian the form was pretty messed up <aside id='edit-search'> <?php echo "<form ole='form' id='form-sidebar' class='form-search'" . "action='{$config->urls->root}search/' method='get'>"; ?> <header><h4>Pesquisa de imóveis</h4></header> <?php echo "<div class='form-group'>" . "<input type='text' name='q' id='search_query' value='" . htmlentities($input->whitelist('q'), ENT_QUOTES, 'UTF-8') . "'" . "</div>"; ?> <p> <label for='search_option_objective'>Objectivo</label> <select id='search_option_objective' name='objective'> <option value=''>Any</option><?php foreach($pages->get("/option_objective/")->children() as $objective) { $selected = $objective->name == $input->whitelist->objective ? " selected='selected' " : ''; echo "<option$selected value='{$objective->name}'>{$objective->title}</option>"; } ?> </select> </p> <p> <label for='search_type_of_deal'>Tipo de negócio</label> <select id='search_type_of_deal' name='type_of_deal'> <option value=''>Any</option><?php foreach($pages->get("/option_type_of_deal/")->children() as $type_of_deal) { $selected = $type_of_deal->name == $input->whitelist->type_of_deal ? " selected='selected' " : ''; echo "<option$selected value='{$type_of_deal->name}'>{$type_of_deal->title}</option>"; } ?> </select> </p> <p> <label for='search_option_new_old'>Estado</label> <select id='search_option_new_old' name='new_old'> <option value=''>Any</option><?php foreach($pages->get("/option_new_old/")->children() as $new_old) { $selected = $new_old->name == $input->whitelist->new_old ? " selected='selected' " : ''; echo "<option$selected value='{$new_old->name}'>{$new_old->title}</option>"; } ?> </select> </p> </form></aside> Form populated in the fronted https://www.dropbox.com/s/4ffadiemn8nhg6o/Screen%20Shot%202014-07-23%20at%2001.31.14.jpg Now I need to generate the search results page filtering the fields(options) in the article template in my tree: Properties (articles-list-all) - Apartments (articles-parent) -- apartment one (article) -- apartment two - Houses -- house one -- house two option_objective (options-template) - Sell - Rent The problem is the search results the options won't filter the article's pages.
  10. Thanks for your patience Adrian! Don't know if it will add more confusion but here is my form, this is testing purposes so its a mess at the moment: <aside id='edit-search'> <?php echo "<form ole='form' id='form-sidebar' class='form-search'" . "action='{$config->urls->root}search/' method='get'>"; ?> <header><h4>Pesquisa de imóveis</h4></header> <?php echo "<div class='form-group'>" . "<input type='text' name='q' id='search_query' value='" . htmlentities($input->whitelist('q'), ENT_QUOTES, 'UTF-8') . "'" . "</div>"; ?> <?php echo "<label>Objectivo</label>"; echo "<div class='form-group'><select name='type'><option value=''>Indiferente</option>"; foreach($pages->get("/option_objective")->children("id!=1594") as $objective) { $selected = $objective->id == $input->whitelist->objective ? " selected='selected' " : ''; echo "<option$selected value='{$objective->id}'>{$objective->title}</option>"; } echo "</select></div>"; echo "<label>Tipo de imóvel</label>"; echo "<div class='form-group'><select name='type'><option value=''>Indiferente</option>"; foreach($pages->find("template=article-parent") as $type_of_article) { $selected = $type_of_article->id == $input->whitelist->type_of_article ? " selected='selected' " : ''; echo "<option$selected value='{$type_of_article->id}'>{$type_of_article->title}</option>"; } echo "</select></div>"; echo "<label>Estado do imóvel</label>"; echo "<div class='form-group'><select name='type'><option value=''>Indiferente</option>"; foreach($pages->get("/option_new_old")->children("id!=1614") as $new_old) { $selected = $new_old->id == $input->whitelist->new_old ? " selected='selected' " : ''; echo "<option$selected value='{$new_old->id}'>{$new_old->title}</option>"; } echo "</select></div>"; echo "<div class='form-group'>" . "<button type='submit' class='btn btn-default'>Pesquisar</button>" . "</div>" ; ?> </form></aside> The search-results.php <?php /** * Search template * */ $out = ''; if($q = $sanitizer->selectorValue($input->get->q)) { // Send our sanitized query 'q' variable to the whitelist where it will be // picked up and echoed in the search box by the head.inc file. $input->whitelist('q', $q); // Search the title, body and sidebar fields for our query text. // Limit the results to 50 pages. // Exclude results that use the 'admin' template. $matches = $pages->find("template=article, title|body~=$q, limit=20"); $count = count($matches); if($count) { $out .= "<h2>$count página(s) encontrada(s):</h2>"; foreach($matches as $m) { $firstimage = $m->images->first(); $thumb = $firstimage->size(250, 0); $out .= "<li><p><a href='{$m->url}'><img src='{$thumb->url}' alt='{$m->title}'> {$m->title}</a><br />{$m->summary}</p></li>"; } $out .= "</ul>"; } else { $out .= "<h2>Não foram encontrados resultados.</h2>"; } } else { $out .= "<h2>Insira um termo/palavra para pesquisar</h2>"; } // Note that we stored our output in $out before printing it because we wanted to execute // the search before including the header template. This is because the header template // displays the current search query in the search box (via the $input->whitelist) and // we wanted to make sure we had that setup before including the header template. include("./head.inc"); echo "<div class='content-section' id='whitebg'>" . "<div class='container'>" . "<div class='row'>" . "<div class='col-md-12 page-content'>"; echo $out; echo "</div>" . "</div>" . "</div>"; include("./foot.inc");
  11. Sending more code probably will add more confusion cause after testing it get the search results for the input text field and not for the selectors. The name of the select field is option_objective This is my article template: https://www.dropbox.com/s/xzee9294eid10sb/Screen%20Shot%202014-07-23%20at%2000.40.25.jpg These are my option's pages although I in the previous snippet I sent the option page was named objective no its named option_objective like the select field: https://www.dropbox.com/s/svnm5gpomcj2fi2/Screen%20Shot%202014-07-23%20at%2000.42.51.jpg This is the site's front end: https://www.dropbox.com/s/6q2ad2if0jwhhi2/Screen%20Shot%202014-07-23%20at%2000.49.56.jpg
  12. I tried with the search.php from the basic profile site, also looked at the skyscraper's profile but now I'am a bit confused on how to generate results. if($q = $sanitizer->selectorValue($input->get->q)) { // Send our sanitized query 'q' variable to the whitelist where it will be // picked up and echoed in the search box by the head.inc file. $input->whitelist('q', $q); // Search the title, body and sidebar fields for our query text. // Limit the results to 50 pages. // Exclude results that use the 'admin' template. $matches = $pages->find("template=article, title|body|objective~=$q, limit=20"); $count = count($matches); if($count) { $out .= "<h2>$count page(s) found:</h2>"; foreach($matches as $m) { $firstimage = $m->images->first(); $thumb = $firstimage->size(120, 120); $out .= "<li><p><a href='{$m->url}'><img src='{$thumb->url}' alt='{$m->title}'> {$m->title}</a><br />{$m->summary}</p></li>"; } $out .= "</ul>"; } else { $out .= "<h2>No results.</h2>"; } } else { $out .= "<h2>Please insert a term</h2>"; }
  13. hi there! I started with the basic PW template and now I have this site tree, it has the categories (apartments, houses etc...) then I have pages that will work as option for the articles, these options are presented in the article as a select input field type. For example objective field name is called option_objective in my article template. root Properties (articles-list-all) - Apartments (articles-parent) -- apartment one (article) -- apartment two - Houses -- house one -- house two Objective (options-template) - Sell - Rent Type of deal (options-template) - Commercial property - Private property Other options (options-template) - other option one ----------------------------------- Page name (template name) To filter and render the results similar to skyscraper's site profile I looked at how selectors work and also at the skycrapper and Macrura's from the speaker's shop example. I can generate the options to select input fields in the frontend but I can't generate the results page. The following is a part of what I have at the moment. I have this part to generate one of the article's option in the search_form.php <option value=''>Any</option> <?php foreach($pages->get("/objective/")->children("id!=1594") as $objective) { $selected = $objective->id == $input->whitelist->objective ? " selected='selected' " : ''; echo "<option$selected value='{$objective->id}'>{$objective->title}</option>"; } Part of the search_results.php $matches = $pages->find("template=article, title|body|objective~=$q, limit=20"); $count = count($matches); echo $out; Thanks in advance for the help.
  14. Yes Wanze, thanks for keeping an excellent support. After a few tests I think it was indeed related with cache, it is working now in MAMP with PW 2.4.8 but at the time I was uploading the site from MAMP to a live server and noticed some weird behaviour using MAMP. I copied the live host version today and tested it today again on MAMP and it works flawlessly.
  15. @horst Thanks horst but the file:/// protocol doesn't seem to work but I will keep the tip in mind for other use in PW
  16. hello wanze. Thanks for the update. I have tested it, but now it does not render the images, I have this is my template: if (count($page->images)) { $someImages = $page->images->slice(0, 4); foreach ($someImages as $someImg) { $someImgThumb = $someImg->size(290, 195); echo "<TD WIDTH='25%'><img src=\"{$someImgThumb->url}\" width=\"{$someImgThumb->width}\" height=\"{$someImgThumb->height}\" /></TD>"; } } I followed your instructions, is there some other way to render the images? Also in the previous version, I couldn't create/view the pdf as a guest, only if I was logged in as a superuser or as an editor. Is there some setting that I should change to create/view the pdf as a guest? Thanks! update: the new updated module was not generating the images in MAMP is working fine on a live host. I can now also view the pdfs as a guest on the live host, in the previous version, even after saving the page as a superuser, after login off I could not view the pdfs in the live host. It seems to be working very well now. Thanks again waze for this great module.
  17. Good clarifications from both of you This is getting a bit out of hand, but one more addition: in current code image isn't actually resized -- it's just forced to specific dimensions with HTML attributes. This could be intentional, but I'm wondering if this might make even more sense here: ... echo "<img src='{$p->images->first->size($resized_imageWidth, $resized_imageHeight)->url}' width='{$resized_imageWidth}' height='{$resized_imageHeight}'>" . "<a href='{$p->url}'>{$p->title}</a><br />"; ... This way end-user doesn't have to download excessively large images, if what you really want here is a thumb. It should also be noted that simply defining width and height with HTML attributes forces image to those exact dimensions without considering actual aspect ratio, which can easily result in distorted images. (More about various options that size() accepts here.) Thanks Teppo for the reminder! The uploaded image will always have the dimensions attributes. Also great contributions from all the forum's members!
  18. oops, You are right! I added the first image from those pages too. $resized_imageWidth = 120; $resized_imageHeight = 0; $session->history = is_array($session->history) ? array_slice(array_merge(array($page->id), $session->history), 0, 4) : array($page->id); foreach ($session->history as $page_id) { $p = $pages->get($page_id); if ($p->template != "basic-page") continue; echo "<img src='{$p->images->first->url}' width='{$resized_imageWidth}' heigth='{$resized_imageHeight}'>" . "<a href='{$p->url}'>{$p->title}</a><br />"; } Thanks again teppo for all the help!
  19. Thanks for the help teppo! Tried to output pages from a specific PW template but it outputs all the pages, maybe there is something wrong with this: <?php $session->history = is_array($session->history) ? array_slice(array_merge(array($page->id), $session->history), 0, 4) : array($page->id); foreach ($session->history as $page_id) { $p = $pages->get($page_id)->find("template=basic-page"); echo "<a href='{$p->url}'>{$p->title}</a><br />"; } ?>
  20. Hello, I'am trying to store the 4 latest visited pages, using sessions and output the first image and title from those pages to the user. Any help is appreciated! Tried $session and PW api variables but couldn't get this to work. This is working but only to get the urls to the page: session_start(); // URL array if (empty($_SESSION['pageurls'])) { $_SESSION['pageurls'] = array_fill(0,4,''); } function trackPage($url) { array_unshift($_SESSION['pageurls'],$url); array_pop($_SESSION['pageurls']); } trackPage($_SERVER['REQUEST_URI']); foreach ($_SESSION['pageurls'] as $page) { echo "<a href='{$page}'>" . $page . "</a>" . "<br/>"; };
  21. Many thanks Ryan and all the contributors to make ProcessWire even more amazing.
  22. Language for dateimeinput field is working and it outputs the portuguese language, after reading this. http://processwire.com/talk/topic/1751-cant-get-pw-to-output-german-month-names/?p=31053
  23. Hello! I tested kixe's example but I get this date: 1 February 1970 $date_lang = array(); switch ($user->language->name) { case 'en': setlocale(LC_ALL, 'en_GB.UTF-8'); $date_lang[0] = "%A %B %eth %Y at %I:%M %p"; $date_lang[1] = "%B %eth %Y"; $date_lang[2] = "%I:%M %p"; $date_lang[3] = "%A"; break; case 'pt': setlocale(LC_ALL, 'pt_PT.UTF-8'); $date_lang[0] = "%A %e %B %Y às %kh%M"; $date_lang[1] = "%e %B %Y"; $date_lang[2] = "%kh%M"; $date_lang[3] = "%A"; break; case 'fr': setlocale(LC_ALL, 'fr_FR.UTF-8'); $date_lang[0] = "%A, den %e. %B %Y à %k.%Mh"; $date_lang[1] = "%e. %B %Y"; $date_lang[2] = "%k.%Mh"; $date_lang[3] = "%A"; break; default: setlocale(LC_ALL, 'pt_PT.UTF-8'); $date_lang[0] = "%A %e %B %Y às %kh%M"; $date_lang[1] = "%e %B %Y"; $date_lang[2] = "%kh%M"; $date_lang[3] = "%A"; } then if($page->date_and_time) echo "<p>" . strftime($date_lang[1], $date_and_time) . "</p>"; else ; I don't use this module but there a member talks about the 1970 date it here too: http://processwire.com/talk/topic/711-release-schedulepages/?p=45172 Did someone get this date output too? edit: Looking now at Unix timestamp to solve this.
  24. Just tested now and moved the tinymce from the site-mymultisite to the site root's folder where I have the processwire installation and its working! yes Joss! this path to the spellchecker also points to the root's server path. spellchecker : /site/tinymce/myplugins/spellchecker Thanks for the quick response.
  25. Thanks Joss and gebeer, for the Zurb Foundation 5 site profiles. I was testing Joss's site profile on a multi-site config in a folder site-mymultisite and the tinymce doesn't work. It worked fine if installed in the server's root site folder, like you mentioned in the first post. Did you tested for multi sites? Thanks!
×
×
  • Create New...