Jump to content

bramwolf

Members
  • Posts

    136
  • Joined

  • Last visited

Everything posted by bramwolf

  1. YES! I fixed it On the course-page, where I set the cookie, and the session variable in the first case, I linked to the subscription page where in turn I wanted to call the cookie. I figured out that on pretty much all the pages within the site Chrome kept the cookie alive, except for the subscription page. I saw al links inside my site ended with a slash, checked the code and saw that the link I made didn't end with the slash. Also, very weird but I didn't add a domain to the cookie creation, and the course page created a www.domain.com instance while the subscribe page seemed to be looking for a .domain.com instance, adding a domain to the cookie fixed this as well. I added it and now chrome keeps the cookie alive Pretty weird that this make so much difference, and that Firefox and Safari don't take the trailing slash into account
  2. Hey Guys, Thanks for the replies! I tried your different syntaxes however with those Firefox, Safari and Chrome failed to display the variable. I'm not sure how I would define a session variable, other than I did? Further I did some testing and read somewhere cookies solved the problem, and cookies also work fine on Firefox and Safari. But Chrome still doesn't, It sets them properly and gives them the session expiration date but when I go to a different page, in this case the subscription page, it gets removed from the cookie list. A think Chrome might be doing the same to Processwire's session variable? I don't know where those are stored but they don't show up in the cookie list. Has anybody heard of this problem? I set cookies like this: document.cookie = "cursus=<?PHP echo $page->title ?>; path=/"; and this to retrieve it: <script type="text/javascript"> function getCookie(name) { var re = new RegExp(name + "=([^;]+)"); var value = re.exec(document.cookie); return (value != null) ? unescape(value[1]) : null; } </script> <script type="text/javascript"> document.write(getCookie("cursus")); </script></div> Oh btw, When searching Google I keep on finding issues where Chrome doesn't clear the session cookies.. :S Well at least I fixed that for everyone, my Chrome super-clears cookies Thanx in advance
  3. Yeah I did, Copied it from the cheatsheet? http://cheatsheet.processwire.com/session/properties-and-methods/session-set-name-value/ I do have the feeling it works? on some browsers? I have no idea what, and why it isn't working properly
  4. Hey Guys, I've ran into some really weird behavior with session variables. What I've been trying to do is this: I have 10 separate pages that share the same template, named cursus.php. These are pages with course info and have different title's. these page all do the following: $session->remove($cursus); $session->set($cursus, $page->title); They all have a link to one page where you can subscribe for the course on that page I call out the session variable and want to recall there from what page they entered the subscription page by doing the following: <div>Subscribe for the course: <?PHP echo $session->get($cursus); ?></div> and that, on it's turn, gets mailed to my client. Now Firefox and Safari seem to be displaying the variable perfectly fine but Chrome is not. I've tried it on my mobile and and desktop and even in incognito mode, which should clear any cache problems, but it still doesn't work. Am i going about this completely the wrong way or does anyone have a suggestion of what the problem could be? As you can image it's very important to my client and thus to me, that I get this working as soon as possible! Any help will be greatly appreciated. Bram Wolf
  5. Hey Guys, I was wondering if anyone came across this before or, if I'm just crazy On different pages I use a simply Body field which is a instance of TinyMCE. If I call it directly as a standalone field ( $page->body ) it outputs line breaks ( <br /> ) in the paragraph where the empty lines in the text are. But, when I use the same field inside a repeater and output it using foreach ($page->slideshow as $slide ) $slide->body, it end the paragraph at each line break in the text. I find this super weird and kinda annoying since you have to use different stylings the create the same effect. Does anyone know why this is and how you could fix it? I would prefer it would always output <BR />'s instead of paragraph ends. thanx Bram
  6. Ah yes! I see what you mean! Quite severe indeed But i actually decided to use this one, since it only lists the other available languages, much better than hardcoding links to all languages i think! <ul id='languageSelection'> <?php foreach($languages as $language) { if(!$page->viewable($language)) continue; // check if page not published for this language $class = "$language" == "$user->language" ? "active" : ""; $url = $page->localUrl($language); $lang = $language->name; if(strcmp($lang,'default') == 0) { $lang = 'nl'; } // default language fix echo "<li class='$class'><a title='$language->title' href='$url'>$lang</a></li>"; } ?> </ul> If this wouldn't give me a internal server error that is
  7. Hey Pete, thanks for your contribution but I decided to trash my own script and go for overoon's version since it makes much more sense any ideas on why that gives me an internal server error? bram
  8. Hey Overoon, Thank you so much for your reply! Your script indeed sounds alot better than mine So I decided to put it to the test but when I implement it in my HTML the site gives me a internal error. I've checked the script and the php lines are flawless, no broken lines or whatever. Any ideas on what could be the problem? I'll try to find the server log and see if it gives any usefull info. thanks Bram
  9. Hey Guys, I'm still wrestling the same problem without any succes. Does anyone have an idea as to what I'm doing wrong? Any help would be greatly appreciated! Grts, Bram
  10. Ah!! Great tips! Thanks for taking the time to elaborate on some stuff I did! I'll keep your comments in mind next time I'll try to write php ( tomorrow I figure ) But for now I'm inclined to go with Martijn's code as it already got me halfway there, and mine didn't Nontheless, thanks man!
  11. Hi there, So, I've tried to code above and it does output the links to the page's content in the available different languages, however when I click the links I keep ending up on the page in the same language I was already in. Any ideas on what I am doing wrong? As apparent, I'm not quite familiar with php or getting it to do with processwire what I want, but it seems to me, from other examples I saw, there should be a ->get($language) statement in the links somewhere? Or is there something else I'm messing up? My languages are setup as following: Default -> Dutch de -> German en -> English thanks in advance
  12. Yeah! I'm gonna try and get this to work, thanks for helping me out man I've been looking everywhere for this code but couldn't find it anywhere! Sorry for being such a n0ob i guess Bram
  13. Hey Guys! I already posted this in Multi-Language but maybe it sits better here, Sorry! I must admit I'm fairly new to all this so I might be overlooking something completely or just not getting it But here's what I want to do! I'm building a website which I want to present in 3 languages. The user should be able to choose his or her language via the use of a button. I created 3 image buttons that send a value to a php script at the bottom of my page, but the page keeps rendering in the default language. Any ideas on what I am doing wrong, or how you would go about achieving this? I would like the user(language) to stay the same as the chosen though the buttons until it is changed again. This is what I have so far : <form action="" method="post"> <input type="text" name="taal" value="nl" style="display:none;"> <input type="image" src="../site/templates/img/vlag_nl.png" name="submit" /> </form> <form action="" method="post"> <input type="text" name="taal" value="de" style="display:none;"> <input type="image" src="../site/templates/img/vlag_de.png" name="submit" /> </form> <form action="" method="post"> <input type="text" name="taal" value="en" style="display:none;"> <input type="image" src="../site/templates/img/vlag_en.png" name="submit" /> </form> <?PHP if(isset($_POST["submit"])) { $taal = $_REQUEST['taal']; $user->language = $languages->get($taal); echo $pages->LocalUrl($taal)->render(); }; ?> Any help would be much appreciated! I've been spending waaay too much time on this piece of hocus pocus already Gr, Bram
  14. Hey Guys! I must admit I'm fairly new to all this so I might be overlooking something completely or just not getting it But here's what I want to do! I'm building a website which I want to present in 3 languages. The user should be able to choose his or her language via the use of a button. I created 3 image buttons that send a value to a php script at the bottom of my page, but the page keeps rendering in the default language. Any ideas on what I am doing wrong, or how you would go about achieving this? I would like the user(language) to stay the same as the chosen though the buttons until it is changed again. This is what I have so far : <form action="" method="post"> <input type="text" name="taal" value="nl" style="display:none;"> <input type="image" src="../site/templates/img/vlag_nl.png" name="submit" /> </form> <form action="" method="post"> <input type="text" name="taal" value="de" style="display:none;"> <input type="image" src="../site/templates/img/vlag_de.png" name="submit" /> </form> <form action="" method="post"> <input type="text" name="taal" value="en" style="display:none;"> <input type="image" src="../site/templates/img/vlag_en.png" name="submit" /> </form> <?PHP if(isset($_POST["submit"])) { $taal = $_REQUEST['taal']; $user->language = $languages->get($taal); echo $pages->LocalUrl($taal)->render(); }; ?> Any help would be much appreciated! I've been spending waaay too much time on this piece of hocus pocus already Gr, Bram
×
×
  • Create New...