Jump to content

ngrmm

Members
  • Posts

    421
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by ngrmm

  1. 1 hour ago, adrian said:

    Those shouldn't have an effect on this. Perhaps you can share your module settings. And also, please try in a browser incognito/private mode to make sure the accept cookies are not already set.

    thx
    problem is solved. found out that the latest adblockplus-browserplugin blocks it ... hihi

    • Like 1
  2. 2 hours ago, LostKobrakai said:

    Prices (or anything else in a shop) should never be by language imho. What if I'm living in a country foreign to my native speaking language. The German living in America should always be able to visit a shop in German (if it's localized), but otherwise shall be treated like any other American.

    thats right, but how about updating prices based on billing address?

  3. hey @kongondo thx for updates

    some years ago i built an multilang-shop with padloper. there is always an issue with prices based on user-lang or user-location.
    some shopowner want to force their users to see the a different product-price based on their location. example:
    user from germany pays: 20€
    user from poland pays: 18€

    i know this not depends on padloper. but maybe there is a possibility for force-switch the language in the new product-template.
    or maybe update the price at the checkout if the user enter in the final billing-address.
    i hope you understand what i mean ?

    • Like 1
  4. the website has several languages: english, german, … (left-to-right) and arabic, farsi (right-to-left)
    englisch is the default-language but only some parts/fields are translated. everything works fine.
    if a text-field has no translation, the default-language will be shown instead.

    BUT there is a problem:
    when user-language is arabic (rtl) i just want to set "dir=rtl" or a class on those div's with arabic-language output.

    i tried it this way. But got an error. I thinks it's because the second field is from another $page.
    Anyway this isn't the best way because $rtl and $langclass should be unique.

    Whats the best way to solve this problem?

    	$userLang = $user->language->name;
    	$userId = $user->language->id;
    
    	$page->of(false); // turn off outputFormatting (if it's not already)
    
    	// get unformatted textfields
    	$body = $page->body->getLanguageValue($userLang);
    	$otherPageTitle = $otherPage->title->getLanguageValue($userLang);
    	
    	// check if user lang is rtl
    	if($userLang == 'fa' || $userLang == 'ar') {
    		
    		// check if var translation exists
    		if(!$body == '') { $rtl = "dir='rtl'"; $langclass = "rtl"; }
    		// no translation: output default
    		else { $body = $page->body->getLanguageValue('default'); }
    
    		// check if var translation exists
    		if($otherPageTitle != '') { $rtl = "dir='rtl'"; $langclass = "rtl"; }
    		// no translation: output default
    		else { $otherPageTitle = otherPageTitle->getLanguageValue('default'); } 	
    
    	}
    
    	echo "<div class='$langclass' $rtl >$body</div>";
    	echo "<div class='$langclass' $rtl >$otherPageTitle</div>";
    

     

  5. i have jpegs inside a folder (images).  the folder is located in the templates-folder of PW
    site > templates > images

    every 30 minutes a script generates  and saves jpegs into the images-folder. the all have a unique filename.
    is it possible to save all those images into a image-field through API?
    if not, is it possible to add the newest one into the imagefield?

    i found this

    $p = $pages->get(1001);
    $p->of(true); // if in a template code, turn off output formatting
    $p->images->add("http://placehold.it/350x150.jpg");
    $p->save();
    $p->of(false);

    but i don't know how to grab the url automaticly of the newest file.

  6. is there a way to output jpegs with a color-overlay?

    i'd like to have a transparent image with a black background. the admin should be able to set the opacity.
    unfortunately i'm not able to change the dom-elements or add some.

    so, i have a div with a background-image and a field where i can set a number (0 – 100). is there a way to let PW create an image with some kind of a color-overlay to darken an image?
     

  7. is there a way to setup a a redirect for all files and children-directories of a directory

    example: 
    /old-dir/
    /old-dir/child-a/
    /old-dir/child-b/
    /old-dir/child-b/test.jpg

    they all should be redirected to /new/
     

    can this be achieved by just one rule? something like /old-dir/* > /new/

     

  8. i manage to get it this way. but i think there should be a better way

     

    			echo "<div class='items'>";
    				$odd = array();
    				$even = array();
    				echo "<div class='odd'>";
    				foreach ($allPages as $k => $v) {
    			   		if ($k % 2 == 0) {
    			        	$even[] = $v;
    						echo "<div>$v</div>";
    			    	}
    				}
    				echo "</div>";
    				echo "<div class='even'>";
    				foreach ($allPages as $k => $v) {		   
    				   	if ($k % 2 !== 0) {
    				        $even[] = $v;
    				        echo "<div>$v</div>";
    				    }
    				}
    			echo "</div>";	

     

  9. i have an array of pages $allPages

    how can i divide them in two groups of odd and even?
    right now i have them in one line. but i want to have them in two groups.

    			$allPages = $xPage->children;
    
    			$counter = ""; 
    			foreach ( $allPages as $item ) {
    				$counter +=1; 
    				if($counter == 1) { 
    					echo "<div class='columns-wrapper odd'>$item</div>";
    				}
    				elseif($counter == 2) { 
    				$counter = 0; 
    			    	echo "<div class='columns-wrapper even'>$item</div>";
    			   	} 
    			} 

    is there a easy way in processwire to get these two arrays?

    $allPages_odd
    $allPages_even

     

  10. On 9.3.2017 at 3:03 PM, justb3a said:

    @FrancisChung Thanks a lot for your feedback and hints. The collaborators of the detection library are working on a new release.

    As soon as the release has been published, I'll update the module.

     

    hmm … module didn't work (pw 3) but when i use the detection library and it works

    // Include and instantiate the class.
    require_once 'Mobile_Detect.php';
    $detect = new Mobile_Detect;
     
    // Any mobile device (phones or tablets).
    if ( $detect->isMobile() ) {
     
    }

     

×
×
  • Create New...