Jump to content

Search the Community

Showing results for tags 'variables'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL







Found 5 results

  1. Some context: I want to use PHP variables in my CSS (more info below) and found a solution on CSS-tricks that looks fairly elegant and somewhat solid to me. It's pretty simple, I created a file style.css.php inside the site/templates/ directory and load that in my page head. In style.css.php is the following: <?php header("Content-type: text/css; charset: UTF-8"); header("Charset:utf-8"); if ($homepage->hero_image) { echo <<<CSS .hero { background: url($homepage->hero_image->url) no-repeat; } CSS; } ?> Because of the following RewriteCond (line 373) in the htaccess file the server sends a 403 error back when the file is requested: # Block access to any PHP or markup files in /site/templates/ or /site-*/templates/ RewriteCond %{REQUEST_URI} (^|/)(site|site-[^/]+)/templates($|/|/.*\.(php|html?|tpl|inc))($|/) [NC,OR] (My htaccess file is @version 3.0 and @htaccessVersion 301) This is how I thought I could fix that (based on these answers on stack overflow) but it does not work: # Block access to any PHP or markup files in /site/templates/ or /site-*/templates/ RewriteCond %{REQUEST_URI} (^|/)(site|site-[^/]+)/templates($|/|/((?!style\.css).)*\.(php|html?|tpl|inc))($|/) [NC,OR] I tested the rule with htacess tester and htaccess check and both worked for me, but on my site I still get a 403 instead of the file. I'm working on localhost, using MAMP (not sure if that's relevant). A bit more about what I want to do achieve specifically: I want to use an image as a background-image for an element, not place it as an image. This image is provided by the user via a field and can therefore change. I know I can achieve this like this: echo "<section class='hero' style='background-image: url($page->hero_image->url)'></section>"; But I would prefer a method other than inlining because of scalability and cleanliness. (I admit the extra link in the page head is not ideal either) P.s. this is my first post here, I hope it's submitted in the right forum and my explanation is clear.
  2. I'm in the process of rebuilding a WordPress site over into ProcessWire (Yay!) I'm using Ajax to call a page (ajaxAgenda) from the homepage which includes a PHP file (partialAgenda) which makes the call. This is what I got in the included partial. Notice that the URL has a / at the end to prevent redirection. var page_number = 1; var get_agenda = function(){ $.ajax({ type : "GET", data : {pnum: page_number}, dataType : "html", url : "/components/ajaxAgenda/", beforeSend : function(){ $('#ajax-loader2').show(); }, success : function(data){ $('#ajax-loader2').hide(); $('#agenda').html(data); } }); } And in the Ajax called file I have the following echo $page->url.'<br>'; echo $input->get->pnum.'<br>'; echo $_GET['pnum'].'<br>'; which only outputs "/components/ajaxagenda/". pnum is empty and get is also also empty It seems like the variables are simply being stripped from my Ajax call. Or am I missing something really obvious?
  3. How would one pass a variable set in one module to another module via a Hook? e.g. module 1. public function ___saveUser($vars){ $userSaved = true } module 2 public function init() { $this->addHookAfter('module1::saveUser', $this, 'userSaved'); } public function userSaved($e){ $userSaved = $e->userSaved; return $userSaved; // true? }
  4. Hey Guys, I've been working with Processwire for a while now but mostly only showed the content that was set in the back-end of Processwire by the site admin. Now I would like to store information but I find it hard to figure out where to start. The problem is dat Processwire uses PHP to get and set new values, which is only a server side language. What i want to do is have variables set bases on user behavior. The Case: I'm building a really small site that sells two items. A have a product page where people can insert a quantity of the item in a form input field and than click add to cart. http://www.hayplaybag.com/producten However I have no clue how to convert that information into say, a global variable or a field on the checkout page so that I could read it again on the shopping cart page and present the amount they ordered. How would you guys go about doing such things? I would love to hear your thoughts Thanks! Bram
  5. 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
  • Create New...