Jump to content

Leftfield

Members
  • Content Count

    39
  • Joined

  • Last visited

Community Reputation

21 Excellent

About Leftfield

  • Rank
    Jr. Member

Profile Information

  • Gender
    Male
  • Location
    Montenegro
  • Interests
    In this order: SEO. Email marketing, Group B, WRC, PPC.

Contact Methods

  • Skype
    mareblume

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Probably I don't have any rights to comment how far PW came since I started using it from the version 2.x. Of course it is hard to balance and I perfectly know what is mixing MVC and framework and CMS. If they ever listened me (in that time I came from the country which had bad reputation for leading the war against neighbors) Joomla! would stay on top of WordPress. For years Joomla! didn't do anything about SEF URLs and it costed that CMS so much. And it was so small effort and thing to do. Please, think about it. Now, for two years I didn't touch any other CMS except PW and I am very very happy like never before and I am not developer.
  2. The main magic is You don't have to install any module to have media manager. There is a bunch of options. Make template "gallery", put all images on that page. Call images via tags or Page Reference or whereverver model you want. That flexibility and finding the best possible model makes me speechless. The thing is, PW is not a pure CMS and it should stay that way. This is so good I can't believe it exist. Kudos to Ryan and team!!!
  3. Hi @ All, I am Miljan and I've spent 10 years in various Joomla! teams and I love Joomla. Saw a lot of things, roads, milestones, changes, decisions and participated but my voice was not loud enough sometimes. Sometimes things went in the wrong direction. There is various CMSs - WordPress (brrr), Joomla!, Drupal, Typo etc etc. Ecommerce: Magento, Os etc etc... There is various frameworks: YII etc etc. So, PLEASE guys, do not change much ProcessWire, especially in those directions, it is excellent as it is. It is fantastic!!! DO NOT make media manager, do not make CMS features you can find everywhere. One thing will lead another and at the end PW would be just as any s*** we all escaped from. Please, improving core and adding here and there certain features would be fantastic. The only thing, maybe, my suggestion, is to gather team (not suggesting myself because for a longer time I am not good programmer) to control modules quality attached to this web and check out the code for malicious things. That's all.
  4. Sorry, wrong window. Sent you in inbox.

  5. Hi All, Two questions please: 1. Is there a simple way to avoid allow_url_open with CURL because of security? 2. Field is recording every X hours in database, os it really gets long after some time - what's the fastest/best way to delete rows backwards?
  6. @dragan yea I know it's hookable. Trying to find optimal solution. Seams like module is excellent solution. Will post result.
  7. Hi @All I am trying to add an link to field "favorite" (checkbox) in the backend in the row "Edit, New, View... Favorite", A link should imitate the field favorite and when you click on it, it should check/uncheck field without editing the page. I assume there is a solution on the forum, but after wide search, couldn't find it. Tried to add it in "List of fields to display in the admin Page List" but you cant check it without editing the page. PW: 3.0.146 PHP: 7.3.5
  8. @MarkE thank you for your answer but it doesn't help since I load files manually (except main js). Anyway, I will remove module for two reasons (both not fault of the module): First: Lon and Lat are not compatible with Google Maps for my country. There is some wild offset. Second: Will test for SEO, doubt is that Google doesn't rank website with Open street map.
  9. Hi @All, When I turn on cache, the map is blank. What variable should I exclude or...!?
  10. Attached files are updated. Keep in mind that home.php and one search.php are in views/ folder. Hi @All. I am making real estate website with map leaflet module. Please keep in mind that I do SEO and SEM and I am NOT an expert in PHP, so if you find anything that could be better or pit-a-pat, please, please fix and comment. Many tricks learned throw @OLSA coding so thank You my great friend. Explanation: I am using template/view folder for logic = separate code and design. Calls for my fields are included in files attached to the post. Hope you'll get the idea. what I have done All of this is preliminary code which will be speeded up but it is working. Not finished but must have: search button on the home if ajax is not working. _main.php file has: include('views/' . $page->template->name . '.php'); but it doesnt have any influence on this code. Just saying if I update this. So, here are parts views/home.php <?php $izdvojene = wire('pages')->find('template=property, state=featured|new, sort=-date, limit=6'); ?> <div id="sadrzaj"> <div id="rezultati"> <?php foreach($izdvojene as $item) : ?> <div class="trecina nekretnina" data-link="<?= $item->url ?>"> <div class="slika"> <img src="<?= $item->images->eq(0)->size(346,220)->url; ?>" alt="<?= $item->images->eq(0)->description ?>" /> <div class="stanje"> <?php $state = $item->state; if ($state->has("name=sold") == 1) { ?><div class="prodato"><?= $state->sold->title ?></div><?php } else { if ($state->has("name=featured") == 1) : ?><div class="izdvojeno"><?= $state->featured->title ?></div><?php endif; if ($state->has("name=new") == 1) : ?><div class="novo"><?= $state->new->title ?></div><?php endif; // if ($state->has("name=hot") == 1) : // endif; if ($state->has("name=gorgeus") == 1) : ?><div class="prelijepo"><?= $state->gorgeus->title ?></div><?php endif; }; ?> </div> <div class="lokacija"><i class="fa fa-map-marker"></i><?php $json = json_decode($item->map->raw); if (isset($json->address->village)) : echo $json->address->village; else : echo $json->address->county; endif; echo ", "; echo $json->address->country; ?> </div> <div class="displeji"><?= $item->images->count(); ?><i class="fa fa-picture-o"></i></div> </div> <h2 class="naslov"><a href="<?= $item->url ?>"><?= $item->title; ?></a></h2> <p class="cijena"><?php if($item->price) : ?><?php echo number_format($item->price,2,",",".");?> &euro;<?php else : ?><?php echo __('Call for price');?><?php endif; ?></p> <p class="uvod"><?= wordLimiter(ripTags($item->body), 120); ?> <?php echo __('Read More');?></p> <p class="sadrzaj"> <?php if($item->surface) : ?><i class="fa fa-th"></i><?= $item->surface ?><?php endif; ?> m<sup>2</sup> <?php if($item->bedrooms) : ?><i class="fa fa-bed"></i><?= $item->bedrooms ?><?php endif; ?> <?php if($item->bathrooms) : ?><i class="fa fa-bath"></i><?= $item->bathrooms ?><?php endif; ?> </p> </div> <?php endforeach; ?> </div> </div> main-search.php which is called by ajax: <?php namespace ProcessWire; ?> <div id="rezultati"> <?php foreach($items as $item) : ?> <div class="trecina nekretnina" data-link="<?= $item->url ?>"> <div class="slika"> <img src="<?= $item->images->eq(0)->size(346,220)->url; ?>" alt="<?= $item->images->eq(0)->description ?>" /> <div class="stanje"> <?php $state = $item->state; if ($state->has("name=sold") == 1) { ?><div class="prodato"><?= $state->sold->title ?></div><?php } else { if ($state->has("name=featured") == 1) : ?><div class="izdvojeno"><?= $state->featured->title ?></div><?php endif; if ($state->has("name=new") == 1) : ?><div class="novo"><?= $state->new->title ?></div><?php endif; // if ($state->has("name=hot") == 1) : // endif; if ($state->has("name=gorgeus") == 1) : ?><div class="prelijepo"><?= $state->gorgeus->title ?></div><?php endif; }; ?> </div> <div class="lokacija"><i class="fa fa-map-marker"></i><?php $json = json_decode($item->map->raw); if (isset($json->address->village)) : echo $json->address->village; else : echo $json->address->county; endif; echo ", "; echo $json->address->country; ?> </div> <div class="displeji"><?= $item->images->count(); ?><i class="fa fa-picture-o"></i></div> </div> <h2 class="naslov"><a href="<?= $item->url ?>"><?= $item->title; ?></a></h2> <p class="cijena"><?php if($item->price) : ?><?php echo number_format($item->price,2,",",".");?> €<?php else : ?><?php echo __('Call for price');?><?php endif; ?></p> <p class="uvod"><?= wordLimiter(ripTags($item->body), 120); ?> <?php echo __('Read More');?></p> <p class="sadrzaj"> <?php if($item->surface) : ?><i class="fa fa-th"></i><?= $item->surface ?><?php endif; ?> m<sup>2</sup> <?php if($item->bedrooms) : ?><i class="fa fa-bed"></i><?= $item->bedrooms ?><?php endif; ?> <?php if($item->bathrooms) : ?><i class="fa fa-bath"></i><?= $item->bathrooms ?><?php endif; ?> </p> </div> <?php endforeach; ?> </div> main.js // Ajax search and scrolling to the form function goToByScroll() { $('html,body').animate({ scrollTop: $("#glavna-pretraga").offset().top-200 }, 'slow'); } function ajaxLoaderClass(){ var container = document.getElementById( "sadrzaj" ); container.classList.toggle("loading"); } function ajaxSearch(){ goToByScroll; ajaxLoaderClass(); $.ajax({ type: "GET", url: 'search\/', data: $('#glavna-pretraga').serialize(), success: function(data){ goToByScroll(); $("#sadrzaj").empty().append(data); ajaxLoaderClass(); } }); } search.php <?php namespace ProcessWire; // other params $property_type = $sanitizer->text($input->get->property_type); $bedrooms_min = $sanitizer->int($input->get->bedrooms_min); $bedrooms_max = $sanitizer->int($input->get->bedrooms_max); $price_min = $sanitizer->int($input->get->price_min); $price_max = $sanitizer->int($input->get->price_max); $sq_min = $sanitizer->int($input->get->sq_min); $sq_max = $sanitizer->int($input->get->sq_max); $pid = $sanitizer->text($input->get->pid); $selector = array(); if($property_type){ $input->whitelist('property_type', $property_type); $property_type = $sanitizer->selectorValue($property_type); $selector[]= "parent=$property_type"; } if($bedrooms_min){ $input->whitelist('bedrooms_min', $bedrooms_min); $sq_min = $sanitizer->selectorValue($bedrooms_min); $selector[]= "bedrooms>=$bedrooms_min"; } if($bedrooms_max){ $input->whitelist('bedrooms_max', $bedrooms_max); $rooms = $sanitizer->selectorValue($bedrooms_max); $selector[]= "bedrooms<=$bedrooms_max"; } if($price_min){ $input->whitelist('price_min', $price_min); $price_min = $sanitizer->selectorValue($price_min); $selector[] = "price>=$price_min"; } if($price_max){ $input->whitelist('price_max', $price_max); $price_max = $sanitizer->selectorValue($price_max); $selector[] = "price<=$price_max"; } if($sq_min){ $input->whitelist('sq_min', $sq_min); $sq_min = $sanitizer->selectorValue($sq_min); $selector[]= "surface>=$sq_min"; } if($sq_max){ $input->whitelist('sq_max', $sq_max); $rooms = $sanitizer->selectorValue($sq_max); $selector[]= "surface<=$sq_max"; } if( $pid ){ $selector = array(); // reset selector $input->whitelist('pid', $pid); $pid = $sanitizer->selectorValue($pid); $selector[] = "pid=$pid"; } // search inside property items $selector[] = "template=property"; // search processing if( $config->ajax ){ // Ajax call $query = implode(',', $selector); $items = $pages->find( $query ); $items_count = $items->count; include('./main-search.php');?> <?php exit(0); } else { // is not Ajax call $selector[] = "sort=price"; $selector[] = "limit=10"; $query = implode(',', $selector); $items = $pages->find( $query ); $pagination = $items->renderPager(array( 'nextItemLabel' => "<span aria-hidden='true'>»</span>", 'previousItemLabel' => "<span aria-hidden='true'>«</span>", 'listMarkup' => "<ul class='pagination pagination-lg'>{out}</ul>", 'itemMarkup' => "<li>{out}</li>", 'linkMarkup' => "<a href='{url}' class='btn btn-raised ripple-effect btn-default'>{out}</a>", 'currentItemClass' => "active" )); // did we find any matches? if( $items->count ){ $message = __("Showing results"); } } ?> Complete files attached with function.php were some functions are. All this files are in root folder (except js) of template. home.php main-search.php search.php main.js _func.php search.php
  11. Here is final solution for the link: /samsung-s10-mobile-phone/pr/f980fd84/ I got tree like this: Products/product articles/details NOTE: template articles has name/URL: "pr" NOTE 2: Product is the main name of the article/articles but all other fields are going in the template details. It was made in case of duplicate name so the hash would be The only difference but the product page would keep children with hash name. See the URLs and picture bellow /samsung-s10-mobile-phone/pr/f980fd84/ /samsung-s10-mobile-phone/pr/d8h3jk1n/ NOTE 3: I am using hidden hash_field as text field on the template details for recording hash URL segmentation enabled on all templates. In product template there is: Profields: Page Table (with the same name as template "Details") with action on product page. Module for making hash: <?php namespace ProcessWire; class AddHashField extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Add Hash Field', 'summary' => 'Populate hash field of product template', 'href' => '', 'version' => 001, 'permanent' => false, 'autoload' => true, 'singular' => true, ); } public function init() { $this->pages->addHookBefore('saveReady', $this, 'AddHashField'); } public function AddHashField($event) { $page = $event->arguments[0]; if($page->template != 'details') return; if(!$page->title){ $hash = hash('CRC32', microtime()); $page->set('title', $hash); $page->set('name', $hash); $page->set('hash_field', $hash); $this->message("Hash is set " . $page->hash_field); } } } In my (probably yours home.php) _main.php file, on the top: <?php namespace ProcessWire; if ($input->urlSegment1 && $input->urlSegment2 == 'pr' && $input->urlSegment3) : $pagename = $input->urlSegment1; $hash = $input->urlSegment3; $match = $page->find("template=details, name={$hash}"); include('views/' . $match->template . 'details.php'); return $this->halt(); endif; On details template: <?php namespace ProcessWire; $parent_name = $input->urlSegment1; $name = $input->urlSegment3; $parent_page = $page->findOne("template=product, name={$parent_name}"); $page = $page->findOne("template=details, name={$name}"); include("./head.inc"); include('./nav.php'); ?> <h1><?= $parent_page->title ?></h1> Function detailsUrl in function.php: function detailsUrl($item){ $out = ''; foreach($item->details as $c){ $out .= '<a href="' .$item->name .'/'. $item->parent->name .'/'. $c->name . '">' . $c->headline . '</a>'; } $out.= '<br />'; return $out; } Listing on the home template: <?php $pages = $pages->find("template=product, sort=date, limit=10"); foreach($pages as $item) : echo detailsUrl($item); endforeach; ?> Now, this is not finished code in home.php, it doesn't list on all products... But I leave your imagination how to handle further. IF anyone needs this rare solution I am here to help. Thanks to motherf.... @OLSA (we are friends) who doesn't let me give him cup.
  12. One of the easiest solutions in my head is: to exclude "/" from regex when creating page->name. Or to query page->title after save, remove number and copy database page_paths path to pages name after save. Hash is unique and that's what makes the page unique.
  13. Hi @All 🙂 I made custom URLs I have unique hash at the end of the every URL of template=product: /nike-air-max-man-running-trainers/pr/832a2805/ Now, I don't need PW to check is there a duplicate page name because it will add to URLs numbers like this (-1, -2, -3...): /nike-air-max-man-running-trainers/pr/832a2805/ /nike-air-max-man-running-trainers-1/pr/9876j536/ /nike-air-max-man-running-trainers-2/pr/54b5221/ /nike-air-max-man-running-trainers-3/pr/0o542761/ etc. How to stop PW from doing this?
×
×
  • Create New...