Jump to content

Flashmaster82

Members
  • Posts

    166
  • Joined

  • Last visited

Everything posted by Flashmaster82

  1. How can i send the form to an email? And also to a new subpage in admin just lite the other module "Simple Contact form".
  2. I need some help.. I´m trying to get the value of an select option field to display in the mail. This is my code <?php $scf = $modules->get( 'SimpleContactForm' ); $options = array( 'offert_typeoffacility' => 'offert_typeoffacility->title', 'btnText' => 'Skicka förfrågan' ); echo $scf->render( $options ); ?> And the "offert_typeoffacility" is the select option field. But it only renderering the value ID instead of the title? I tried also the message option in the module backend. Typ av fastighet: %offert_typeoffacility% but it only rendering the same ID. Do you guys have any solution to this? Please help
  3. Ok to make it more understandable. This is the other filter (dropdown) in the skyscraper demo. This works but in my case i dont want to be filtering with any range only specific category. search-form.php <div class='uk-width-1-2'> <div class='uk-form-row'> <label class='uk-form-label' for='search_floors'>Floors</label> <div class='uk-form-controls'> <select id='search_floors' name='floors' class='uk-form-width-large'> <option value=''>Any</option><?php // generate our range of floors, checking to see if any are already selected foreach(array('1-20', '20-40', '40-60', '60-80', '80+') as $range) { $selected = $range == $input->whitelist->floors ? " selected='selected'" : ''; echo "<option$selected value='$range'>$range floors</option>"; } ?> </select> </div> </div> </div> and in the search.php foreach(array('floors', 'year') as $key) { if(!$value = $input->get->$key) continue; // see if the value is given as a range (i.e. two numbers separated by a dash) if(strpos($value, '-') !== false) { list($min, $max) = explode('-', $value); $min = (int) $min; $max = (int) $max; $selector .= "$key>=$min, $key<=$max, "; $summary[$key] = (substr($max, 0, 3) == '999') ? "$min and above" : "$min to $max"; $input->whitelist($key, "$min-$max"); // see if the value ends with a +, which we used to indicate 'greater than or equal to' } else if(substr($value, -1) == '+') { $value = (int) $value; $selector .= "$key>=$value, "; $summary[$key] = "$value and above"; $input->whitelist($key, "$value+"); // plain value that doesn't need further parsing } else { $value = (int) $value; $selector .= "$key=$value, "; $summary[$key] = $value; $input->whitelist($key, $value); } }
  4. Hi Kongondo and thanks for replying. Here is the _func.php. All files are straight from the Skyscrapers demo btw. <?php namespace ProcessWire; /*************************************************************************************** * SHARED SKYSCRAPER FUNCTIONS * * The following functions find and render skyscrapers are are defined here so that * they can be used by multiple template files. * */ /** * Returns an array of valid skyscraper sort properties * * The keys for the array are the field names * The values for the array are the printable labels * * @return array * */ function getValidSorts() { return array( // field => label 'name' => 'Name (A-Z)', '-name' => 'Name (Z-A)', 'date' => 'Publish date (asc)', '-date' => 'Publish date (desc)', ); } /** * Find Skyscraper pages using criteria from the given selector string. * * Serves as a front-end to $pages->find(), filling in some of the redundant * functionality used by multiple template files. * * @param string $selector * @return PageArray * */ function findSkyscrapers($selector) { $validSorts = getValidSorts(); // check if there is a valid 'sort' var in the GET variables $sort = sanitizer('name', input()->get('sort')); // if no valid sort, then use 'title' as a default if(!$sort || !isset($validSorts[$sort])) $sort = 'name'; // whitelist the sort value so that it is retained in pagination if($sort != 'name') input()->whitelist('sort', $sort); // expand on the provided selector to limit it to 10 sorted skyscrapers $selector = "template=youtube_channel_video, limit=20, " . trim($selector, ", "); // check if there are any keyword searches in the selector by looking for the presence of // ~= operator. if present, then omit the 'sort' param, since ProcessWire sorts by // relevance when no sort specified. if(strpos($selector, "~=") === false) $selector .= ", sort=$sort"; // now call upon ProcessWire to find the skyscrapers for us $skyscrapers = pages($selector); // save skyscrapers for possible display in a map mapSkyscrapers($skyscrapers); return $skyscrapers; } /** * Serves as a place to store and retrieve loaded skyscrapers that will be displayed in a google map. * * To add skyscrapers, pass in a PageArray of them. * To retrieve skyscreapers, pass in nothing and retrieve the returned value. * * @param null|PageArray $items Skyscraper pages to store * @return PageArray All Skyscraper pages stored so far * */ function mapSkyscrapers($items = null) { static $skyscrapers = null; if(is_null($skyscrapers)) $skyscrapers = new PageArray(); if(!is_null($items) && $items instanceof PageArray) $skyscrapers->add($items); return $skyscrapers; } /** * Render the <thead> portion of a Skyscraper list table * * @return string * */ function renderSkyscraperListSort() { // query string that will be used to retain other GET variables in searches input()->whitelist->remove('sort'); $queryString = input()->whitelist->queryString(); if($queryString) $queryString = sanitizer('entities', "&$queryString"); // get the 'sort' property, if it's present $sort = input()->get('sort'); $validSorts = getValidSorts(); // validate the 'sort' pulled from input if(!$sort || !isset($validSorts[$sort])) $sort = 'name'; $options = array(); $selectedLabel = ''; // generate options foreach($validSorts as $key => $label) { if($key === $sort) $selectedLabel = $label; $options["./?sort=$key$queryString"] = $label; } // render output $out = files()->render('./includes/skyscraper-list-sort.php', array( 'options' => $options, 'selectedLabel' => $selectedLabel )); return $out; } /** * Render a list of skyscrapers * * @param PageArray $skyscrapers Skyscrapers to render * @param bool $showPagination Whether pagination links should be shown * @param string $headline * @return string The rendered markup * */ function renderSkyscraperList(PageArray $skyscrapers, $showPagination = true, $headline = '') { $pagination = ''; $sortSelect = ''; $items = array(); if($showPagination && $skyscrapers->count()) { $headline = $skyscrapers->getPaginationString('Skyscrapers'); // i.e. Skyscrapers 1-10 of 500 $pagination = renderPagination($skyscrapers); // pagination links $sortSelect = renderSkyscraperListSort(); } foreach($skyscrapers as $skyscraper) { $items[] = renderSkyscraperListItem($skyscraper); } $selector = (string) $skyscrapers->getSelectors(); if($selector) $selector = makePrettySelector($selector); $out = files()->render('./includes/skyscraper-list.php', array( 'skyscrapers' => $skyscrapers, 'headline' => $headline, 'items' => $items, 'pagination' => $pagination, 'sortSelect' => $sortSelect, 'selector' => $selector )); return $out; } /** * Render a single skyscraper for presentation in a skyscraper list * * @param Page $skyscraper The Skyscraper to render * @return string * */ function renderSkyscraperListItem(Page $skyscraper) { // here's a fun trick, set what gets displayed when value isn't available. // the property "unknown" is just something we made up and are setting to the page. $skyscraper->set('unknown', '??'); // send to our view file in includes/skyscraper-list-item.php $out = files()->render('./includes/skyscraper-list-item.php', array( 'skyscraper' => $skyscraper, 'title' => $skyscraper->title, 'category' => $skyscraper->youtube_video_category->title, )); return $out; } /** * ProcessWire pagination nav for UIkit * * @param PageArray $items * @return string * */ function renderPagination(PageArray $items) { if(!$items->getLimit() || $items->getTotal() <= $items->getLimit()) return ''; $page = page(); if(!$page->template->allowPageNum) { return "Pagination is not enabled for this template"; } // customize the MarkupPagerNav to output in Foundation-style pagination links $options = array( 'numPageLinks' => 5, 'nextItemLabel' => '<i class="uk-icon-angle-double-right"></i>', 'nextItemClass' => '', 'previousItemLabel' => '<span><i class="uk-icon-angle-double-left"></i></span>', 'previousItemClass' => '', 'lastItemClass' => '', 'currentItemClass' => 'uk-active', 'separatorItemLabel' => '<span>&hellip;</span>', 'separatorItemClass' => 'uk-disabled', 'listMarkup' => "<ul class='uk-pagination uk-text-left'>{out}</ul>", 'itemMarkup' => "<li class='{class}'>{out}</li>", 'linkMarkup' => "<a href='{url}'>{out}</a>", 'currentLinkMarkup' => "<span>{out}</span>" ); $pager = modules('MarkupPagerNav'); $pager->setBaseUrl($page->url); return $pager->render($items, $options); } /** * Make the selector better for display readability * * Since we're displaying the selector to screen for demonstration purposes, this method optimizes the * selector is the most readable fashion and removes any parts that aren't necessary * * This is not something you would bother with on a site that wasn't demonstrating a CMS. :) * * @param string $selector * @return string * */ function makePrettySelector($selector) { if(preg_match('/(architects|parent)=(\d+)/', $selector, $matches)) { if($page = pages()->get($matches[2])) $selector = str_replace($matches[0], "$matches[1]={$page->path}", $selector); if($matches[1] == 'parent') $selector = str_replace("template=youtube_channel_video, ", "", $selector); // template not necessary here } $selector = sanitizer('entities', $selector); $span = "<span class='uk-text-nowrap'>"; $selector = $span . str_replace(", ", ",</span> $span ", $selector) . "</span>"; return $selector; } /** * Generate a summary from the given block of text or HTML and truncate to last sentence * * @param string $text * @param int $maxLength * @return string * */ function summarizeText($text, $maxLength = 500) { if(!strlen($text)) return ''; $summary = trim(strip_tags($text)); if(strlen($summary) <= $maxLength) return $summary; $summary = substr($summary, 0, $maxLength); $lastPos = 0; foreach(array('. ', '!', '?') as $punct) { // truncate to last sentence $pos = strrpos($summary, $punct); if($pos > $lastPos) $lastPos = $pos; } if(!$lastPos) { // if no last sentence was found, truncate to last space $lastPos = strrpos($summary, ' '); } if($lastPos) { $summary = substr($summary, 0, $lastPos + 1); // and truncate to last sentence } return trim($summary); } The main thing i want to fix is how to add more filters. The one that i working with is (categories). If i only filter with youtube channel (which is a modifyed by the city filter) it works and the result are visible, but then the category filter is not working. So in the search-form.php i have this. The first section in the code below is the drop down for the channels and the second is the category filter. <div class='col-6'> <div class='row'> <label class='uk-form-label' for='youtube_channel'>Youtube channel</label> <div class='uk-form-controls'> <select id='youtube_channel' name='youtube_channel' class='uk-form-width-large'> <option value=''></option> <?php // generate the youtube_channel options, checking the whitelist to see if any are already selected foreach($pages->find("template=youtube_channel_page") as $youtube_channel) { $selected = $youtube_channel->name == $input->whitelist->youtube_channel ? " selected='selected' " : ''; echo "<option$selected value='{$youtube_channel->name}'>{$youtube_channel->title}</option>"; } ?> </select> </div> </div> </div> <div class='col-6'> <div class='row'> <label class='uk-form-label' for='category'>Category</label> <div class='uk-form-controls'> <select id='category' name='category' class='uk-form-width-large'> <option value=''>Category</option> <?php // generate the category options, checking the whitelist to see if any are already selected foreach($pages->find("template=youtube_channel_video, sort=youtube_video_category") as $category) { $selected = $category->youtube_video_category == $input->whitelist->youtube_video_category->title ? " selected='selected' " : ''; echo "<option$selected value='{$category->youtube_video_category}'>{$category->youtube_video_category->title}</option>"; } ?> </select> </div> </div> </div> and then in the search.php i have this. <?php namespace ProcessWire; $selector = ''; $summary = array( "title" => "", "youtube_channel" => "", "category" => "", ); if($input->get('youtube_channel')) { $youtube_channelName = $sanitizer->pageName($input->get('youtube_channel')); $youtube_channel = pages("/youtube-videos/$youtube_channelName/"); if($youtube_channel->id) { $selector .= "parent=$youtube_channel, "; $summary['youtube_channel'] = $youtube_channel->title; $input->whitelist('youtube_channel', $youtube_channel->name); } } foreach(array('category', 'floors', 'year') as $key) { if(!$value = $input->get->$key) continue; // see if the value is given as a range (i.e. two numbers separated by a dash) if(strpos($value, '-') !== false) { list($min, $max) = explode('-', $value); $min = (int) $min; $max = (int) $max; $selector .= "$key>=$min, $key<=$max, "; $summary[$key] = (substr($max, 0, 3) == '999') ? "$min and above" : "$min to $max"; $input->whitelist($key, "$min-$max"); // see if the value ends with a +, which we used to indicate 'greater than or equal to' } else if(substr($value, -1) == '+') { $value = (int) $value; $selector .= "$key>=$value, "; $summary[$key] = "$value and above"; $input->whitelist($key, "$value+"); // plain value that doesn't need further parsing } else { $value = (int) $value; $selector .= "$key=$value, "; $summary[$key] = $value; $input->whitelist($key, $value); } } if($input->get('keywords')) { $value = $sanitizer->selectorValue($input->get('keywords')); $selector .= "title|body%=$value, sort=title"; $summary["keywords"] = $sanitizer->entities($value); $input->whitelist('keywords', $value); } $videos = findSkyscrapers($selector); $browserTitle = 'Youtube video search - '; foreach($summary as $key => $value) { if($value) { $key = ucfirst($key); $browserTitle .= ucfirst($key) . ": $value, "; } else { unset($summary[$key]); } } region('browserTitle', rtrim($browserTitle, ', ')); region('content', files()->render('./includes/search-summary.php', array('items' => $summary)) . renderSkyscraperList($videos) ); The code that starts with this is what im trying to modify from the demo, but its wrong of course, because in the demo it targets a field and a range (floors/year). My filter with category is an drop down option field in the backend. When im loading the page website/search.php it shows all the youtube videos and the pagination, so it works but its only the category filter that is wrong just to be clear. foreach(array('category', 'floors', 'year') as $key) {
  5. Hi, i need some help with the filtering based on the Skyscrapers demo/func. I´m not that great with php so be patient. My structure looks like this Youtube videos > Youtube channel > Video on the video template (youtube_channel_video) i have multiple drop down fields and other fields that i would like to filter on the front end. I also have other pages that need this functions with search/filter etc but with different filters. This is the code i have in my search-form.php. Right now i experimenting with the field/option (category) that every video have in their template. The first filter (youtube_channel) works but im trying to get the category filter to work. <div id='skyscraper-search' class='uk-panel uk-panel-box xuk-panel-box-primary uk-margin-bottom'> <h3 class='h3'>Youtube videos</h3> <form class='uk-form uk-form-stacked' method='get' action='<?php echo $config->urls->root?>search/'> <div class='row'> <label class='uk-form-label' for='search_keywords'>Keywords</label> <div class='uk-form-controls'> <input type='text' class='uk-form-width-large' name='keywords' id='search_keywords' value='<?php if($input->whitelist('keywords')) echo $sanitizer->entities($input->whitelist('keywords')); ?>' /> </div> </div> <div class='col-6'> <div class='row'> <label class='uk-form-label' for='youtube_channel'>Youtube channel</label> <div class='uk-form-controls'> <select id='youtube_channel' name='youtube_channel' class='uk-form-width-large'> <option value=''></option> <?php // generate the youtube_channel options, checking the whitelist to see if any are already selected foreach($pages->find("template=youtube_channel_page") as $youtube_channel) { $selected = $youtube_channel->name == $input->whitelist->youtube_channel ? " selected='selected' " : ''; echo "<option$selected value='{$youtube_channel->name}'>{$youtube_channel->title}</option>"; } ?> </select> </div> </div> </div> <div class='col-6'> <div class='row'> <label class='uk-form-label' for='category'>Category</label> <div class='uk-form-controls'> <select id='category' name='category' class='uk-form-width-large'> <option value=''></option> <?php // generate the category options, checking the whitelist to see if any are already selected foreach($pages->find("template=youtube_channel_video") as $category) { $selected = $category->youtube_video_category == $input->whitelist->youtube_video_category ? " selected='selected' " : ''; echo "<option$selected value='{$category->youtube_video_category}'>{$category->youtube_video_category->title}</option>"; } ?> </select> </div> </div> </div> <div class='uk-margin-top'> <button type='submit' id='search_submit' class='uk-button uk-button-primary' name='submit' value='1'> <i class='uk-icon-search'></i> Search </button> </div> </form> </div> This is my search.php <?php namespace ProcessWire; $selector = ''; $summary = array( "title" => "", "youtube_channel" => "", "category" => "", "country" => "", ); if($input->get('youtube_channel')) { $youtube_channelName = $sanitizer->pageName($input->get('youtube_channel')); $youtube_channel = pages("/youtube-videos/$youtube_channelName/"); if($youtube_channel->id) { $selector .= "parent=$youtube_channel, "; $summary['youtube_channel'] = $youtube_channel->title; $input->whitelist('youtube_channel', $youtube_channel->name); } } foreach(array('category') as $key) { if(!$value = $input->get($key)) continue; else { $value = (int) $value; $selector .= "$key=$value, "; $summary[$key] = $value; $input->whitelist($key, $value); } } if($input->get('keywords')) { $value = $sanitizer->selectorValue($input->get('keywords')); $selector .= "title|body|category%=$value, sort=title"; $summary["keywords"] = $sanitizer->entities($value); $input->whitelist('keywords', $value); } $videos = findSkyscrapers($selector); $browserTitle = 'Youtube video search - '; foreach($summary as $key => $value) { if($value) { $key = ucfirst($key); $browserTitle .= ucfirst($key) . ": $value, "; } else { unset($summary[$key]); } } region('browserTitle', rtrim($browserTitle, ', ')); region('content', files()->render('./includes/search-summary.php', array('items' => $summary)) . renderSkyscraperList($videos) ); This is my skyscraper-list-item.php file <?php echo " <div class='col-12 col-sm-12 col-md-6 col-lg-6 col-xl-4 col-xxl-4 col-xxxl-4 bmar10'> <div class='youtube_search_holder'> <a data-fancybox data-autoclose='true' data-width='1500' data-height='844' data-height='360' href='{$skyscraper->youtube}autoplay=1'> <div class='youtube_thumbnail_placeholder'><img src='{$skyscraper->youtube_thumbnail->url}' class='youtube_thumbnail_image w-100'> <div class='playicon'></div></div></a> <div class='youtube_search_thumbnail_content'> <div class='h6 text-uppercase green tmar3 title'><a href='{$skyscraper->parent->channel_url}' target='_blank' title='{$skyscraper->parent->title}'>{$skyscraper->parent->title}</a></div><div class='text-uppercase white h3 limit'><a href='{$skyscraper->youtube}' data-fancybox data-width='1500' data-height='844' data-height='360'>{$skyscraper->title}</a></div> <div class='h5 text-uppercase gray date'>{$skyscraper->youtube_video_publishdate}</div> <span class='white h7'> {$skyscraper->youtube_video_category->title} {$skyscraper->countries->title} {$skyscraper->competition->title} {$skyscraper->competition->parent->parent->title} {$skyscraper->armwrestler_competition_gender->title} {$skyscraper->armwrestler_arm->title} {$skyscraper->armwrestler_age_category->title} {$skyscraper->competition_weight_class->title} {$skyscraper->competition_video_match->title} {$skyscraper->videotags} </span> </div></div></div> "; ?> This is the front end right now (no styling ? In the category filter, right now there is multiple categories with the same name, i would also like to restrict it to just one result per category. Please help!
  6. Is it possible to just show a list (page reference) but without any radio buttons? Or a drop down but the references is not selectable? The items needs to be references but the main thing is that its just a list. Please help!
  7. I managed to find a solution in another topic. <?php $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if($event->object->hasField == 'profiles') { $page = $event->arguments('page'); $event->return = $event->pages->find("template=profile_page, team_page={$page->parent}"); } }); ?>
  8. Thanks for your reply but still no results... if i remove , sports_team=$relative It will show all profile names so i works almost. If i put that string on the actual page either id or name it will show just those profile names but on the admin maybe there is something different you have to write im clueless..
  9. Hi, can you guys help a beginner with a problem.. On my template (profile_page) i have a dropdown (page reference) where i can choose a sports team (team_page) that is related to that profile which is also its parent. Then on my Competition1 page (competition_page) I have page reference field (profiles) a dropdown that i want to display only profiles that has choose a specific sports team (template=team_page) the page parent to be specific. Structure/Template Sports_team1 (team_page) Profile1 (profile_page) Profile2 (profile_page) Profile3 (profile_page) Competition1 (competition_page) ready.php <?php $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if($event->object->hasField == 'profiles') { $relative = $page->parent->name; $event->return = $event->pages->find("template=profile_page, sports_team=$relative"); } }); ?> This returns with no results in the dropdown. If i remove sports_team=$relative then it displays all profiles that have profile_page as template, so it works almost. But i will have more sports teams so this is just an example. I only want to display the profiles that has choosen the parent team on there profile page in admin not front end. I hope i was able to explain it so you guys can understand a little bit. Need some help please! /Thanks
  10. Hi, i´m building a sports website where you can sign up and get your own profile that is also linked to a team page. On the team page i want 1 user to be admin and could edit the page as well. I also trying to build/implement a Tournament Bracket example (https://codepen.io/rzencoder/pen/JaQreL) or (https://codepen.io/mattpantoja/pen/eYmzKjR) page where the user could set up there local tournament with say 8/16 etc competitors based on the users on the team. I have set up a tournament_page.php and a page reference to the team (option), but i dont know how to save the value of the options (front end) to the page. Also i want to make a result list afterwards based on the values. The example link above is jquery, maybe its better to work on a simpler php solution instead im really lost here. If there is someone out there that have a better idea of something that could make this work i would highly appreciate it. I´m just a beginner at php so i really need some help from you guys /thanks
  11. Not working with Png or Svg images... Any solutions?
  12. Because they will still be visible on my website even when moved to archive.
  13. can someone please help me. I´m using this module in the PW 3.. and its working as it should. I have a jobboard and when the pages gets archived i want them to be unpublished, is that possible?
  14. Happy dance!!! ? yaaay!!! I think i looks awesome now and it works perfect! Thank you so much for the help you are the best!!
  15. This is how it looks like now, when i go over with the mouse the cursor will show upp but when i click on it it wont open?
  16. This is my css now .upper-links { display: inline-block; padding: 0 11px; line-height: 23px; letter-spacing: 0; color: inherit; border: none; outline: none; font-size: 12px; } .dropdown { position: relative; display: inline-block; margin-bottom: 0px; } .dropdown:hover #gf-f { display: block !important; } .dropdown .dropdown-menubar { position: absolute; top: 100%; display: none; background-color: #fff; color: #333; left: 0px; border: 0; border-radius: 0; box-shadow: 0 4px 8px -3px #555454; margin: 0; padding: 0px; } #gf-fbtn { position: relative; display: block; width: 160px; height: 30px; border: 1px solid #ddd; background: #f5f5f5; cursor: pointer; text-indent: 50px; color: #707070 !important; left: 0px; line-height: 29px; } .gf-ful li { height: 22px; } .gf-if { width: 24px; height: 18px; position: absolute; top: 6px; left: 15px; } #glbfooter a { font-size: 12px; } #gf-fbtn { cursor: pointer; text-indent: 50px; color: #707070 !important; line-height: 29px; } #gf-fbtn-arr { position: absolute; right: 10px; top: 13px; height: 4px; width: 8px; } .gh-spr, .gh-sprRetina { background-image: url('../assets/misc/nav/img/sprd-arrows.png'); background-repeat: no-repeat; } #glbfooter a { font-size: 12px; } #gf-fbtn { cursor: pointer; text-indent: 50px; color: #707070 !important; line-height: 29px; } #gf-fbtn:hover > #gf-f { display: block; } #gf-f { position: absolute; width: 160px; background: #f5f5f5; border-left: 1px solid #dddddd; border-bottom: 1px solid #dddddd; border-right: 1px solid #dddddd; z-index: 9; } #gf-f .gf-if { display: block !important; position: relative; left: -28px; top: -21px; } .default { display: inline-block; background: url('../assets/misc/nav/img/se.svg') no-repeat; text-indent: -9999px; text-align: left; background-position: center; top: 8px; left: 10px; width: 20px; height: 12.5px; } .english { display: inline-block; background: url('../assets/misc/nav/img/gb.svg') no-repeat; text-indent: -9999px; text-align: left; background-position: center; top: 30px; left: 10px; width: 20px; height: 10px; } .sinhalese { display: inline-block; background: url('../assets/misc/nav/img/lk.svg') no-repeat; text-indent: -9999px; text-align: left; background-position: center; top: 50px; left: 10px; width: 20px; height: 10px; } .down-blue, .down, .down-s-b, .down-s { display: inline-block; background: url('../assets/misc/nav/img/sprd-arrows.png') no-repeat; overflow: hidden; text-indent: -9999px; text-align: left; } .down-blue { background-position: -2px -0px; width: 24px; height: 12px; } .down { background-position: -2px -14px; width: 24px; height: 12px; } .down-s-b { background-position: -2px -28px; width: 8px; height: 4px; } .down-s { background-position: -12px -28px; width: 8px; height: 4px; }
  17. Ok now the dropdown showed up! Yaay ? I replaced the sprite icons with 3 of my svg icons that i wanted for the site. Replaced the code with the one you sent me but the dropdown menu wont open?
  18. Thanks for the css, i put that in the bottom of the nav.php <link rel="stylesheet" href="<?=$config->urls->templates;?>css/dropdown.css"> and changed the paths to the images that you attached. See my attachment for the current result. /thanks
  19. Thanks Flydev for the reply, i will try to read more about basic php ? I didnt have a _init.php or other files that make some codingthings with the language, so i defined it in the beginning like you sad. <?php $homepage = $pages->get('/'); ?> <div class="navbar_language_wrapper"> <?php $langswitch = ''; foreach($languages as $language) { if(!$page->viewable($language)) continue; // is page viewable in this language? if($language->id == $user->language->id) { // current user language $langswitch .= "<li class='current'>"; } else { $langswitch .= "<li>"; } $url = $page->localUrl($language); $hreflang = $homepage->getLanguageValue($language, 'name'); $langswitch .= "<a hreflang='$hreflang' href='$url'>$language->title<b class='gf-if gspr {$language->name}'></b></a></li>"; } echo "<ul class='langswitch'>{$langswitch}</ul>"; ?> Now i have the language in a list so i guess its one step closer to the finish ? Did you have some css for that?
  20. Hi Flydev and bernhard and thanks for helping a beginner ? Flydev, thanks for learning me about the variable names. Is this more correct of should i use for example <?=$p->phone;?> whats the different? can i use $p for universal of the whole site? <?php $footer = $pages->get("/misc/footer/");?> <?php foreach($footer->navigation as $footer ): ?> <div class="col-12 col-sm-6 col-md-3 col-lg-2 col-xl-2"> <ul> <div class="bold purple bmar2 h5"> <?=$footer->heading;?> </div> <?php foreach($footer->navlinks as $footer) { echo "<li class='footer_links_selected'><a href='$footer->url' class='black footer_links '>$footer->title</a></li>"; } ?> </ul> </div> <?php endforeach;?> <div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-4 text-right"> <?php $footer = $pages->get("/misc/footer/");?> <div class="footer_phone"> <?=$footer->phone;?> </div> <div class="footer_email"> <?=$footer->email;?> </div> </div> About the multi language dropdown. I tried to just replace my code with yours, but it then gave me error (see attachment) <div class="navbar_language_wrapper"> <?php $langswitch = ''; foreach($languages as $language) { if(!$page->viewable($language)) continue; // is page viewable in this language? if($language->id == $user->language->id) { // current user language $langswitch .= "<li class='current'>"; } else { $langswitch .= "<li>"; } $url = $page->localUrl($language); $hreflang = $homepage->getLanguageValue($language, 'name'); $langswitch .= "<a hreflang='$hreflang' href='$url'>$language->title<b class='gf-if gspr {$language->name}'></b></a></li>"; } echo "<ul class='langswitch'>{$langswitch}</ul>"; ?> </div> Thanks for helping me!
  21. think i fixed it changed it to <?php $page3 = $pages->get("/misc/footer/");?> (page3 instead of page) ?
  22. Ok i think i know what the problem is. in nav.php this code is making it not work in section1.php <?php $page = $pages->get("/misc/footer/");?> <?php foreach($page->navigation as $page ): ?> <div class="col-12 col-sm-6 col-md-3 col-lg-2 col-xl-2"> <ul> <div class="bold purple bmar2 h5"> <?=$page->heading;?> </div> <?php foreach($page->navlinks as $item) { echo "<li class='footer_links_selected'><a href='$item->url' class='black footer_links '>$item->title</a></li>"; }?> </ul> </div> <?php endforeach;?> <?php $page = $pages->get("/misc/footer/");?> <div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-4 text-right"> <div class="footer_phone"> <?=$page->phone;?> </div> <div class="footer_email"> <?=$page->email;?> </div> <?php $page = $pages->get("/misc/footer/");?> is the problem can i code it in another way?
×
×
  • Create New...