Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/22/2014 in all areas

  1. You're right. Each field requires a table of it's own. "Templates = tables" is figurative speech -- that's just roughly how they function from the developers point of view. The main point here is that each template is a collection of fields and in this way resembles table in database. Each page is connected to one template, and thus that template defines what data this particular page can store, and that's also why some people prefer to think that "pages = rows". Does this make any more sense to you? One noteworthy difference from database concept is that each field can belong to multiple templates. This is done so that fields with identical configurations (such as "body" field with same tools) can be used in many templates without having to add and configure new field for each template. As a side note, most developers using ProcessWire never dive into the real database structure. You don't have to do that to work effectively with ProcessWire. Don't get stuck at those things since that's something that the system handles for you (and, in fact, it's never recommended to perform direct SQL operations on existing tables).
    6 points
  2. 1. 2. 3. http://processwire.com/api/ Take a basic installation local and have a look at the basic-site profile templates as a example. Try to get a HTML Template working in PW like in the first 2 videos and make next steps....i'm actually running trow this, too Processwire is great and the main thing is the concept of creating content.....reading form a other threat: Best Regards mr-fan (Tip the search in this forum isn't that best use google + site: search instead....)
    4 points
  3. Super Smartypants is a ProcessWire textformatter module which adds support for languages. It also allows you to set the different Smartypants Typographer parser attributes to customize which rules apply and fixes some bugs. Super Smartypants requires the language module. Usage After installation, add /site/modules/TextformatterSuperSmartypants/smartypants.php to your language translations. To enable Super Smartypants for a language, set the Smartypants attributes field to 1 (or see below for details), otherwise to disable leave the field empty. Change default strings according to your masterful typographic knowledge. Documentation and download : https://github.com/plauclair/SuperSmartypants
    3 points
  4. That statement stood out, to me, as something you may want to investigate further (Backbone.js app code structure/security/URL results). I mean you need to find out how the Backbone.js app could possibly be affecting your results. Reason: The behavior that you are mentioning is not a known basic ProcessWire behavior. Without eliminating the possible effect(s) the Backbone.js code has on your site structure, you will be chasing ghosts. Maybe someone else who is qualified on Backbone.js issues can rule out what I'm talking about. Another way to rule out any effect Backbone.js is having is if you are able to have a test ProcessWire website on the same server (local or hosting), using the same version of ProcessWire and PHP, without any Backbone.js code involved, I wonder what the result would be regarding published/unpublished pages generating mysterious 404s? I hope you figure it out, as it is indeed interesting and unusual behavior for a ProcessWire website. Best Regards, Charles
    3 points
  5. There is also https://code.google.com/p/pubsubhubbub/. I still didn't take the time to go through their docs because I didn't have a need for this, but have it bookmarked on delicious for some time already.
    3 points
  6. Here's a fun recipe... Install https://play.google.com/store/apps/details?id=eu.apksoft.android.smsgateway on an old android phone with a cheap sim with plenty of free sms messages. Expose the phone's webserver using https://pagekite.net/ (might be a bit of a challenge) (PageKite has been mentioned here before. Thanks Marty!) Send sms messages to your heart's content.
    3 points
  7. The quick answer, Regardless of the hack, if you are using shared, VPS or even dedicated server hosting, even ProcessWire can be affected. If the site that you manage is using the same user account and/or on the same virtual/physical server as a compromised WordPress or Joomla site, any compromise can indeed affect the ProcessWire installation. If there are no old/new WordPress or Joomla installations under the situations I described and you are having this problem, then yes there may be an issue with ProcessWire. Please let us know if this is the case, however I doubt if it is, since we would have already seen this occur in other ProcessWire installations worldwide. PHARMA is an old hack, but it doesn't mean it hasn't been updated. Either way, you need to work with the security team at your webhost to identify and mitigate any issues. Please keep us informed on your progress clearing this issue up. Best Regards, Charles
    2 points
  8. In this situation I would either cache the list of years using something like MarkupCache, or use the Date Archiver module to have an additional layer in the page tree for the years, which would be quick and easy to loop through.
    2 points
  9. There isn't much to explain in ifttt: if in one "channel" this happens then do in another "channel" that. Where channels are different social media sites, sms, email and others. But theres not much of a message hub as you mentioned and the triggers aren't realtime, they are triggered between every 15 minutes to a few hours, if I remember it right. Ifttt is more useful for "yeah, thank you to remember me" notifications, where your usecase is more about really important notifications.
    2 points
  10. Great thing about Pushover for my use case is that you can configure critical alerts to disregard things like phone being on silent mode.. and, of course, those can also trigger an alarm-sound that's sure to wake you up in no time. That combined with it being real-time (push, not pull) and a common hub (account) that all messages can go through (making it possible for one email or API request to trigger notifications on multiple devices simultaneously) make it pretty awesome It would seem that IFTTT might supports something similar, but from different point of view: receiving an email (or text message or any other supported trigger) can trigger an event, which are apparently provided as applications of sorts. Interestingly one of those events is Pushover, so I'm guessing that "Pushover-like" functionality probably isn't built-in in IFTTT. @Diogo (or anyone else with experience using this), am I getting this right? IFTTT website is so incomprehensible ("marketing-oriented" might be the correct word here -- a teaser with "join now" buttons everywhere) that I couldn't be really sure about anything. Being more than a bit stubborn, I refuse to install an app just to see what it does (or, better yet, "join" something that doesn't even explain what the heck it really is that I'm joining..)
    2 points
  11. Hi altogether, since I am currently working on a project that has (hopefully) the potential to reach a certain level of complexity at some point, I wanted to start the template structure in a scalable and "proper" way. In the following I'll try to give a summary about the approach I'm testing: 1. Directory structure inside site/templates/ /controllers/ /views/ 2. Create init file named... site/templates/init.php...containing (for example): <?php function getPartial($name, $allpages) { // Site wide $settings = $allpages->get('/meta/settings'); $root = $allpages->get('/'); // User related $loggedInUser = wire('user')->isLoggedin(); // Page related $title = wire('page')->title; $children = wire('page')->children; $template = wire('page')->template; include($config->urls->templates . 'controllers/' . $name . '.php'); include($config->urls->templates . 'views/' . $name . '.php'); } 3. Uncommenting prepandTemplatefile in /site/config $config->prependTemplateFile = 'init.php'; 4. Creation of partial (controller and view) in their respective folders /site/templates/controllers/test-partial.php /site/templates/views/test-partial.php Example controller: <?php $homepagetitle = $root->title; Example view: <h1><?= $homepagetitle ?></h1> <p><?= $title ?></p> 5. Creation of layout file. I tried to put these in a folder called /layouts, but that does results in PW not finding new templates anymore in the PW Admin when creating a new templates. Any ideas? Changing index.php's $config->urls->templates ? Example layout: <html> <head> <title>Foo</title> </head> <body> <?php getPartial('test-partial', $pages); ?> </body> </html> So, for some reason I have to explicitly inject $pages or wire('pages') into getPartial() - but I have no idea why, since $page or wire('page') is working without problems in the functions scope. But: The output is just as intended. The title of the root page in a h1 headline, and the title of the page using this "layout" in a paragraph. Any feedback or pointing to pitfalls of this approach would be highly appreciated Best, marcus edit: Funny, essentially this is a very stripped down way of Template Data Providers, which needed Twig the last time I tried to use it.
    1 point
  12. Hi, I am interested if you guys allow me to help
    1 point
  13. What's the output for the url? $config->urls->root should be "/" if processwire isn't installed in a subdirectory, so maybe you just missed the third slash after the "http://". If you want to get the domain name I think you have to use $config->httpHost. But you could simply use a relative url instead.
    1 point
  14. Oh! - Antti, many thanks for asking me, - but due to my lack of css and js knowledge I would not do it alone. Maybe you / we can ask Owzim if he is interested in this too?
    1 point
  15. I've been thinking about the same thing to be honest for a while. Some way of creating fields that aren't necessarily fields in the normal sense (so save field info to JSON array, no db tables) and store the template as JSON as well would be great. Just a simple form helper that doesn't have a backend or tables and you can then do what you want with the submitted information. That might sound a but like Formbuilder but there are scenarios where Formbuilder isn't the tool I need (plenty where it is though).
    1 point
  16. Oh wow, someone obviously took my post the wrong way and changed the title of this topic. Plenty of good examples over on the PHP site with explanations of the functionality so please anyone don't be surprised or offended if anyone here refers you to docs or other sites sometimes or we would repeat ourselves and duplicate content found elsewhere.
    1 point
  17. Maybe a little off-topic/semantics, but I found this enlightening: PHP and Model View Controller: impossible! So yeah, it is a bit muddling to use MVC in the context of PHP, while at the same time we have JavaScript frameworks that employ the original Smalltalk MVC concept. Here's a talk from European Smalltalk User Group Conference called "MVC Revival on the Web". There is even a Smalltalk web application framework called AIDAweb.
    1 point
  18. no framework or layers like smarty but a blank canvas with a power api - everything is "a page" http://processwire.com/talk/topic/2296-confused-by-pages/ http://processwire.com/talk/topic/5667-help-a-noob-get-started/page-2#entry55820 +> with processwire total freedom. start here => https://processwire.com/talk/topic/4173-grouped-forum-posts-links-articles-tutorials-code-snippets/ avoid repeated beginners questions by first starting to dig categories in community support. Lots of helpful members in the forum. Welcome.
    1 point
  19. Awesome, thanks! Seems I have been unneccessarily scared to touch this jquery stuff myself - your example seems simple enough For the reference, I also in fact found a a very simple, light-weight and good-looking (smoothproducts, demo) just a while after posting my question, but I like the ability to be able to roll an own and be in full control, so I'll experiment with both a bit and see which works best. Cheers
    1 point
  20. Hi! As apeisa mentioned, this is very simple to build. Unless you need preloading, transitions etc, something like this should cover your needs. <img id="big" src="image1.jpg"> <div id="thumbnails"> <a href="image1.jpg"><img src="image1_thumb.jpg"></a> <a href="image2.jpg"><img src="image2_thumb.jpg"></a> <a href="image3.jpg"><img src="image3_thumb.jpg"></a> </div> And jQuery... $("#thumbnails a").on('click', function(e) { e.preventDefault(); $('#big').attr('src', $(this).attr('href')); });
    1 point
  21. Thanks guys, I have fixed that issue by adding a new getModule($key, $options) method to the Modules class that lets you retrieve a module with $options. In this case an option called 'noPermissionCheck'. The ServicePages module has been updated to use the new method (when available). Adrian, I wasn't seeing the "it" GET variable. That is a GET variable used internally by PW, but it gets removed before the request starts. So if you are seeing an "it" variable then you probably shouldn't be. At least I'm not seeing it here. I did go ahead and add that as something for ServicePages to ignore though, per your suggestion.
    1 point
  22. For the login, you would create a login form and based on who they are, direct them to the appropriate landing page. This can be tricky to update if you're hardcoding all the partner companies into your script (don't do that). Instead, for each company, create a user. Then, based on the users role, they can access pages that they are allowed to manage. You might find the Page Edit Per User module handy http://modules.processwire.com/modules/page-edit-per-user/ Or the Page Edit Per Role module http://modules.processwire.com/modules/page-edit-field-permission/ . I am actually working on a front end admin for users of a company intranet and that's along the lines of how I do it.
    1 point
  23. Feasibly it's possible, but it's not desirable. Making wire('var') aware of context involves pre-compiling the template files to replace wire('var') with wire($this, 'var'). So it's something we do to provide backwards compatibility in template files. We won't be providing that backwards compatibility outside of template files, so people will have to use $this->var, $this->wire('var') or wire($this, 'var'); elsewhere. Also, a Static::syntax implies dealing with a framework that only has one context, which gives the appearance of a weakness that isn't there, something I think we'd want to avoid. While I'd really like to limit statics in ProcessWire as much as possible (just because they are more than often a bad programming practice), that syntax is perfectly fine for static functions where context doesn't matter or where you are passing the context into it. For example, $sanitizer functions would not need to have different behavior in different contexts. I've even seen some frameworks that do use statics for sanitization functions as well. In the end though, IMO they would still be better served by providing the same functions non-statically. The plan is that when you do this... $main = new ProcessWire('/site/'); $intranet = new ProcessWire('/site-intranet/'); ...everything in each of those two instances will be unique to those instances and whatever site files are stored in /site/ or /site-intranet/. That means that when a module is initialized, it is only initialized for the instance (whether main or intranet). When a module refers to $this->var, it's referring to API variables that are part of its instance only. This enables you to have multiple sites talking to each other. Currently this isn't possible precisely because PW uses statics for API variables behind the scenes. But the fact that we've kept that behind the scenes is a good thing because that means it doesn't matter how our API variables are stored. We can switch them to a stronger storage mechanism that would be tied to an instance. This is one reason why I deprecated the Wire::getFuel() syntax (that appeared in early versions of PW2) early-on... though you might still see it appear in a few core spots, which will need to be changed. But we've really tried to keep the public API clear of static calls so that the API would not have to change as PW continues to grow as a framework.
    1 point
  24. Hey people, at last found the solution (getting width and height attributes for img tags into HTML created with CKEditor) : In /site/modules/InputfieldCKEditor/ckeditor-4.1.2/ changed config.js from: /** * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.editorConfig = function( config ) { // Define changes to default configuration here. For example: config.language = 'de'; config.uiColor = '#FEE673'; }; To the following (explanation in the comments): /** * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * ...finally found out how to force CKE to output attributes instead of styles for img width and height: * * Important: additionally to adding everything form "CKEDITOR.on('instanceReady', function (ev)..." onward * also the line "config.allowedContent = true;" needs to be added or else it has no effect! * Joe */ CKEDITOR.editorConfig = function( config ) { // Define changes to default configuration here. For example: config.language = 'de'; config.uiColor = '#FEE673'; config.allowedContent = true; CKEDITOR.on('instanceReady', function (ev) { // Ends self closing tags the HTML4 way, like <br>. ev.editor.dataProcessor.htmlFilter.addRules( { elements: { $: function (element) { // Output dimensions of images as width and height if (element.name == 'img') { var style = element.attributes.style; if (style) { // Get the width from the style. var match = /(?:^|\s)width\s*:\s*(\d+)px/i.exec(style), width = match && match[1]; // Get the height from the style. match = /(?:^|\s)height\s*:\s*(\d+)px/i.exec(style); var height = match && match[1]; if (width) { element.attributes.style = element.attributes.style.replace(/(?:^|\s)width\s*:\s*(\d+)px;?/i, ''); element.attributes.width = width; } if (height) { element.attributes.style = element.attributes.style.replace(/(?:^|\s)height\s*:\s*(\d+)px;?/i, ''); element.attributes.height = height; } } } if (!element.attributes.style) delete element.attributes.style; return element; } } }); }); }; That does it, problem solved! It just seems that img width and height attributes make images load faster than putting them in styles, so this is what I wanted to do here. Found the solution here: http://ckeditor.com/forums/CKEditor/Forcing-img-tag-to-use-width-and-height-attributes-instead-of-style in combination with the hint from dragan in: http://processwire.com/talk/topic/3972-ckeditor-with-attritbutes/?hl=ckeditor I´m sure there might have been other solutions, like switching to TinyMCE or re-writing the CKEditor-created field content in the page´s template file as I wanted to do at first, but this seems to work nicely and so I´ll stick with it. Thanks everyone for your help!
    1 point
  25. Thanks for your post. What you are doing looks right, except that you can skip creating the Pageimages field. PW would rather do that internally. So this is the entirety of what you should do (after you have your $page object): <?php $page->images->add("path or URL to image"); $page->save(); If you are doing this from a template file (as opposed to a shell script or admin module), you have to turn the output formatting off first, as you saw. This is to ensure that you don't accidentally add runtime-formatted content to a page and save it. By "runtime-formatted", I mean entity encoded, markdown, etc. This example might better explain it: <?php $mypage = $pages->get(123); echo $mypage->title; // value is "Products & Services" $mypage->setOutputFormatting(false); echo $mypage->title; // value is "Products & Services" Now lets say that you did this instead: <?php $mypage = $pages->get(123); $mypage->title = "Great " . $mypage->title; $mypage->save(); If ProcessWire let you save that page, the 'title' field would now have this value the next time you viewed it: Great Products && Services Basically, PW only wants to save content in an unformatted "clean" state. It throws that error asking you to set output formatting OFF in order to protect against you corrupting your content. So to follow up from the first example, this is what you should do if you are doing this import from a template file: <?php $page->setOutputFormatting(false); $page->images->add("path or URL to image"); $page->save();
    1 point
×
×
  • Create New...