Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/31/2013 in all areas

  1. Try loading the rcdmap on header instead of footer.
    2 points
  2. 2 points
  3. I was about to snap that up to secure it but Adam beat me to it by the looks of it looking at the whois records
    2 points
  4. We've just launched a new company, early days and we needed to get a site out quickly. http://www.milktop.co.uk Still plenty of fiddling to be done and we're pretty busy on other work, just didn't want to be one of those web companies without their own site
    1 point
  5. Hi folks. I've been lurking here for a while, trying to figure how things work before I overhaul my site. Anyway, I've no doubt I'll be asking for help at some point(s), so I didn't want to arrive empty handed. MarkupLorenIpsum Module for Processwire This module hooks after Page Render, and replaces any [lorem] tags found with random lorem ipsum text. How to use [lorem<length><format>] <length> (optional) number - sets the length of the output. Default is 5. <format> (optional) char - sets the format of the output, as follows: - 't' - formatted text. Each paragraph begins with a tab char. 'p' - plain text. No tabs or line feeds. 'h' - html. Each paragraph is formatted with <p>...</p>, except the first and last (see below). 'H' - html. Each paragraph is formatted with <p>...</p>. The default format is 'h' unless the length is <= the default, in which case the format is 'p' - useful for headings etc. The [lorem] tag is replaced with the generated text. Note that paragraph length is 100 (this is set in the construtor). Samples: - 'h': lorem ipsum lectus dapibus ... sapien malesuada.</p><p> auctor sapien, arcu inceptos ... consequat metus litora. 'H': <p>lorem ipsum lectus dapibus ... sapien malesuada.</p><p> auctor sapien, arcu inceptos ... consequat metus litora.</p> 't': \tlorem ipsum lectus dapibus ... sapien malesuada.\n\n\t auctor sapien, arcu inceptos ... consequat metus litora. 'p': lorem ipsum lectus dapibus donec sapien malesuada auctor sapien, arcu inceptos aenean consequat metus litora. Examples :- [lorem] - renders 5 words, plain format [loremh] - renders 5 words, html format [lorem20] - renders 20 words, html format [lorem20H] - renders 20 words, html format, wrapped in <p>...</p> [loren20p] - renders 20 words, plain format [loren20t] - renders 20 words, text format The reason for the two html options is that the textarea editor inserts <p> tags itself, so you would get <p><p>lorem...dapibus</p></p>. By default the extra tags are stripped, but this can be overidden if desired. It's built using example2 from the HelloWorld module as a wrapper for Mathew Tinsley's LoremIpsumGenerator class. markuploremipsum.zip
    1 point
  6. Another way to accomplish it is to have the template calling $page->render(); stuff the $originalPage into $page. In this case, /site/templates/main.inc: <div class='widgets'><?php // render widgets $widgets = $page->widgets; if(!$widgets || !count($widgets)) $widgets = $homepage->widgets; foreach($widgets as $widget) { $widget->originalPage = $page; // ADD THIS LINE echo "<div class='widget'>" . $widget->render() . "</div>"; } ?></div> Then in widget-recent-posts.php: $posts = $pages->find("template=post, id!=$page->originalPage, sort=-date, start=0, limit=$limit");
    1 point
  7. You can only pass static strings to the __() function. At least, the translation parser will only be able to find static strings. The only reason you'd put a variable in a call to the __() function, is if you knew the text was already available translated, and wanted to retrieve the translated version. But that text would have had to appear statically, somewhere else in the file. To make a multi-langage image field, you can use a Repeater. Your repeater would contain two fields: 'image' and 'summary'. Make the 'image' field of type Image, and set to to contain max 1 image. Make the 'summary' field of type TextLanguage (or TextareaLanguage). The Image field is the next one on the list to make multi-language capable, so should be within the next major version of ProcessWire.
    1 point
  8. Very nice! But it took a long time to load here. Not sure if that's because of the connection that IP is going through, or if it's the result of loading and rendering data for 533 pages (?) in one request. But if you are loading that many pages in one request, it's good to keep in mind that you can only scale so far using that method. Eventually, you'll fill up memory if that table keeps growing. If it's not going to keep growing, then you may want to at least cache it with MarkupCache. Usually if I'm rendering something that's reusable and has 50+ pages loading as a result, I use MarkupCache to cache the output.
    1 point
  9. Not a direct answer to your question but this seems like a really inefficient structure you got there. You could do something like this instead. /stores/ /store-1/ /store-12/ /store-13/ /cities/ /berlin/ /munich/ /cologne/ /categories/ /cat1/ /cat2/ /cat3/ and then enable URL segments on the category template, allowing for further filtering by city. So it works like: /categories/cat1/ ---> show all store that have this cat. /categories/cat1/berlin ---> show all stores that have cat1 and are located in berlin In this case berlin would be urlsegment1 (not an actual page). If you don't know already some info is to be found for example in this thread. In your case, a store can probably only be in 1 city, so you could even further structure it like: cities -city --store
    1 point
  10. InputfieldEmail does this validation for you. PHP's built-in mail() function makes this pretty simple: $body = "This is the message body"; $subject = "Web Contact"; $emailFrom = $form->get('email')->value; $emailTo = 'you@domain.com'; mail($emailTo, $subject, $body, "From: $emailFrom");
    1 point
  11. Hi, I had some free time so i made this patch to improve PW localization support little more. Changes are made in these files: /wire/modules/Fieldtype/FieldtypeCache.module /wire/modules/Fieldtype/FieldtypeComments/FieldtypeComments.module /wire/modules/Fieldtype/FieldtypeComments/InputfieldCommentsAdmin.module /wire/modules/Fieldtype/FieldtypeComments/CommentFilterAkismet.module Seems like localization dont work for file CommentForm.php I can overload strings in frontend template file but not thrue standard localization file. Example: /srv/http/pw_translate/wire/modules/Fieldtype/FieldtypeComments/CommentForm.php: 122 123 // default labels 124: $this->options['labels']['cite'] = $this->_('Your Name'); 125 $this->options['labels']['email'] = $this->_('Your E-Mail'); 126 $this->options['labels']['website'] = $this->_('Your Website URL'); Ryan: can you check this patch and merge it please?
    1 point
  12. Gabi, this one's a bit tricky as PW does not maintain accessible information about the original page when another page gets rendered - which is what happens when showing the Recent Posts widget. So, as it is, the widget does not know which page it's being shown on and thus can't exclude that page from the list. See Ryan's comment here on a very similar question. In that other thread there's a general solution (via a module) to make the original page accessible. To solve this particular case you don't necessarily need a module though, but you can do the very same thing right before rendering the widgets, here (site/templates/main.inc, line 138), like this: Wire::setFuel('originalPage', $page); After this you can exclude the original page from the list by modifying the selector here (site/templates/widget-recent-posts.php, line 14), like this: $originalPage = Wire::getFuel('originalPage'); $posts = $pages->find("template=post, id!=$originalPage, sort=-date, start=0, limit=$limit"); I haven't tested this but I'd say it should work.
    1 point
  13. Just a couple of notes - firstly, for anyone reading into throwing 404s in ProcessWire the preferred (as in used more in code samples here) way of doing this now seems to be this: throw new Wire404Exception(); Also, I tried using an include file at the top of my template called global.inc that does some global bits and pieces and I noticed that it seems impossible to throw Wire404Exception in an included file - it amusingly throws an exception
    1 point
  14. Possibly what makes the most sense, is to just pass one variable? The developer can pass an array or a single string, or an object, e.g. for strongly typed view-models if wanted. If you did want to pass an array and have it extracted as local variables, all you'd have to do is call extract($data) in your child-template - it's not a lot of work...
    1 point
  15. The minute I read this I thought: "You are gonne love ProcessWire" I've spent a horrible year using ExpressionEngine and my life brightened up when I gave ProcessWire a try. Enjoy.
    1 point
  16. Hi guys, Finished this one up in Jan, been meaning to post it. Have a few more that are done but need some final polish, I'll post those up soon. www.contactla.com - Pretty simple site, but client was extremely happy with the setup and how easy it is for them to change content/pricing tables. Can't really express how much I enjoy doing sites in processwire. THANK YOU RYAN !!!!!!
    1 point
  17. @RJay Here the step to get it working. You need to enable two plugins and add the "rel" attribute to the valid elements in TinyMCE. You can edit the configuration of TinyMCE on the field settings under the tab "Input". There's a collapsed fieldset TinyMCE Advanced Configuration Options. Add the two plugin contextmenu and advlink to the plugins text field: ...,contextmenu,advlink Then in the field valid_elements add rel to the @[id|class] so it won't get stripped off: @[id|class|rel] Now when you have done that you go edit your text and add a link using the PW link dialog. Then click on the link using context menu (right click) and select "Insert/Edit link". You'l be presented with a ton of attributes you can set to the link. But you need to also add them to the valid_elements first.
    1 point
  18. Ryan, thanks for the prompt reply. It seems both of us are right. From a ProcessWire codebase point-of-view, you are right: almost all the code written (added/removed) on those 11 missing commits is already on dev. I say almost because there are 3 lines of code introduced in master that are still missing in dev, as you can see below. $ git diff dev...master diff --git a/wire/modules/Fieldtype/FieldtypePage.module b/wire/modules/Fieldtype/FieldtypePage.module index 06e0f65..c5e2669 100644 --- a/wire/modules/Fieldtype/FieldtypePage.module +++ b/wire/modules/Fieldtype/FieldtypePage.module @@ -254,6 +254,9 @@ class FieldtypePage extends FieldtypeMulti { } else if(ctype_digit("$value")) { // page ID $result = $this->pages->get("id=" . $value); + + } else if(strpos($value, '|') !== false && ctype_digit(str_replace('|', '', $value))) { + $result = $this->pages->getById(explode('|', $value)); } else if(strpos($value, '|') !== false && ctype_digit(str_replace('|', '', $value))) { // CSV string separated by '|' characters So, again, you are correct: at some point, probably by copy-pasting chunks of code, you introduced into dev the pieces of code (the changes) on those 11 commits. A proof of that is that the changes introduced in commit 9b3039d (an atomic change, only present in master) are also part of commit 7dab612, which is a huge commit in dev. It's almost as if you cherry-picked (see git cherry-pick) but in a manual, human, untidy way. So far, so good. And the only changes you missed to move manually are those shown on the git diff output above. From a Git point-of-view, I'm right: 11 commits done in master aren't part of the dev branch. Even Github shows that same info here (dev is 11 commits behind and 4 ahead of master) and here (comparing both branches, it shows the same diff as above). Technically speaking, from a Git point-of-view, master and dev have diverged. So, now that we all have a better understanding of what happened and what is missing from dev branch (just 3 lines of code), let me suggest what would have been better options to bring the changes from those 11 commits in master branch back to dev branch. As said, Ryan, you did it manually, but that's prone to (human) errors, as changes could be missed and/or introduced with errors. First (best) option: as suggested on previous post, just merging master (righ now, or back at the time when you did those 9 commits now known as "2.2.9.final") back to dev is all that's needed. Right now, that action will just bring to dev those 3 lines of code missing, by creating a merge commit. In the graph, it will clearly show that those commits are part of dev and there won't be any doubt. Back at that time, that action would have bring the many lines of code missing, releasing you from the task (human & prone to errors) of manually having to copy-paste them. Second option: git cherry-pick. Right now, this option won't make sense, as you already "cherry-picked" the changes from master back to dev in a human fashion. Back at that time, if for some reason (I can't think of one) you couldn't merge master back to dev, git cherry-pick would have been the best option, as it lets you manually pick which commits from master you would like to re-apply to dev. Take into consideration that cherry-picking commits from a branch (ie. master) creates new commit objects on the destination branch (ie. dev). A commit created by a cherry-pick will have a different hash than the original commit (the one cherry-picked), but it will introduce the same exact set of changes (ie. the same +/- patches). Bottom line: while standing on dev branch run "git merge master" and call it a day. Mmmmm. Personally, I'll suggest to stay with the "dev" name for the development branch. Something you could do is that, after some release (ie. 2.3.0), on the next commit, on some project file (ie. readme.txt, or changes.txt, or version or whatever you use) you rename the version to 2.3.1-dev. In this example, it's important to get that "2.3.1-dev" means "the development done for next 2.3.1 version", and not "the development done after 2.3.1 release". Then, on some place of the PW admin, you could print "ProcessWire (2.3.1-dev)". But the question remains: at which exact commit of the many commits that may correspond to the development of 2.3.1 is this PW installation standing at? I'm not sure what's the answer for this, but Git may be helpful here. There is the git describe with "shows the most recent tag that is reachable from a commit". For example, if in your PW repo you run: $ git describe master You will get this output: 2.2.9.final-174-ga8024bb Which means that master branch is 174 commits above the "2.2.9.final" tag, more precisely in the commit a8024bb. The "g" is just a prefix to indicate that is a commit done in Git. So, as you can see, there is a good way to describe where is standing someone in relation to last tagged version. Ryan, 2 last things: First, as you are the BDFL and main commiter of ProcessWire, I'd suggest you to begin using annotated tags: http://git-scm.com/book/en/Git-Basics-Tagging#Annotated-Tags Second, I'd suggest taking a peek at this Git branching model: http://nvie.com/posts/a-successful-git-branching-model/ It's a pretty popular one, and it may fit into the way PW is currently being developed. Even if you don't want to follow that (or any other) particular branching model, the article is pretty good to clear up some concepts. That's all by now, thanks for reading.
    1 point
  19. Greetings Everyone, I am building a site for a public television station using ProcessWire, and I am making use of JQuery datatables to allow admins to display and sort show listings. NOTE: The site is in its very early stages at the moment, but I wanted to at least show how I'm using databales with ProcessWire. It's pretty incredible how much you can do combining ProcessWire with DataTables! To see a page in progress, with 533 listings, look here: http://50.22.43.61/~wnpt/tennessee-crossroads-listings/ Thanks, Matthew
    1 point
  20. This sounds like a good solution to me. I can see this being useful. Though I'd probably want to make any relative paths relative to the /site/templates/ dir, just to prevent any ambiguity about the starting point.
    1 point
  21. Thanks Nico, you managed to confuse me even more...
    1 point
  22. I kind of like the current possibility to change template file on the fly. If that is common need then it might be good to have it as a argument for render. Makes nice and clean code: $news->render("snippets/list.php") $page->render("themes/mobile.php") Etc.
    1 point
×
×
  • Create New...