-
Posts
6,808 -
Joined
-
Last visited
-
Days Won
159
Everything posted by Soma
-
Cool site! Thanks for posting. Not sure about something I glimpsed at the code. I don't think you need to include 3 times the jQuery core script <script src="http://amberanderson.co.uk/js/jquery-1.7.2.min.js"></script> <script src="http://amberanderson.co.uk/js/jquery-ui-1.8.18.custom.min.js"></script> <script type="text/javascript" src="/site/templates/scripts/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="/site/templates/scripts/main.js"></script> <script type="text/javascript" src="/site/templates/scripts/jquery-1.7.2.min.js"></script>
-
Actually this doesn't have to do anything with the blank fields in the translation. If Ryan adds new modules, they first would have to be added to the de translation so it generates its own json file. It doesn't do that automaticly.
-
Only way: API, or module using API
-
I also thought about this in particular when creating an online gallery, it's not as easy but possible. I'm not sure about sizes and page loads as I think google indexes without loading images, I think that's was their image search does. Only limit I know is for tablets and phone that will crash on about 500kb, images are different. The concept would be simple but will require some work and figuring out. You generate a gallery 1 page a image that works with normal urls and segments, then progressively enhance it using ajax to create the page (image page) loading and replacing of the content. In the templates you create a image view with caption that is returned if loaded via ajax. If not requested via ajax you add header and footer from the rest of the site. You can test this with the $config object. A view might look like this (pseudo code): if(!$config->isAjax) { include("./header.inc"); } // get what image should be displayed from ajax request (post) if($config->ajax) { $imgcat = $input->post->category; $imgname = $input->post->imgname; $img = ... // do some magic to get image and output it. } else { // alternatively get the image from urlSegments $imgcat = $sanitize->name($input->urlSegment1); $imgname = $sanitize->name($input->urlSegment2); $img = ... } echo "<figure>"; echo "<img src='{$img->url}' alt='{$img->alt}'/>"; echo "<figcaption>{$img->description}</figcaption>"; echo "</figure>"; if(!$config->isAjax) { include("./footer.inc"); } If a visitor comes through google with the urls segment url, you can do some jquery/js magic to check the url and if usr has js he will get redirected to a url that can fully use your ajax gallery. So if google comes it will browse a regular "static" version, if a visitor comes with js he will get enhanced features. You could also go as far to implement some plugin that allows for history either using hashs or push state. I don't know if there a jquery gallery that would help on this, or if you would have to code it yourself.
-
Reading and displaying data from a custom table
Soma replied to einsteinsboi's topic in General Support
If it's a table in PW DB you can do SQL queries like this: $result = $this->db->query("SELECT id, name, title, url FROM yourtablename WHERE id=$id"); Some modules use this , if you look at ProcessRedirects for example https://github.com/apeisa/ProcessRedirects -
Reading and displaying data from a custom table
Soma replied to einsteinsboi's topic in General Support
Maybe this is of interest. -
..and the first like! Welcome.
-
This should be possible to add to the module. Though don't know how. ProcessPageList can't be used, but Page::viewable I remember using but doesn't work. Page::viewable does hook, but then setting $event->return = false to hide certain pages doesn't do anything.
-
yeah it's "==" not "=". if you use "value == field" it won't happen as it will throw an error.
-
You could add an image field and hide it , so its invisible in the backgound. I woudnt worry too much about.
-
I added mcmorry to the author too.
-
Sorry, I was assuming, as you questioned not being able to do so, that you needed to do so. No that's cool I just misinterpreted what you were saying. One thing comes to mind, sometimes also knowing exactly what thing you're building, will often help finding alternative ways, maybe finding even better solutions. But if you're trying things out to see what's possible and where the limits are that's ok.
-
Cool, glad you found it out. Thanks for letting us know
-
I didn't really mean it, but I thought it's something I would search first and then ask if nothing found. And as I know there was such a thread already I wanted to search it as I know it can be hard to find things here sometimes. I also suggest to use google "site:processwire.com keyword" search as it will be much more successful.
-
Strange as the url http://localhost:888...re/news/?page=2 suggest that page numbers aren't enabled on template thus the GET version of it. If it's enabled it should be /page2 ... Edit: I'd guess you already have read the pager documentation ?
-
Thanks, but this isn't a module and it's not from soma (well I added the third-party config option to the TinyMCE field in PW). It's just to show how to use the advanced options to integrate a TinyMCE plugin from outside the core.
-
Have been testing a little and so far it works well.
-
Ok let me search that for you
-
And why you also want them to insert in the page body tinymce text? You could still use a "textimages" field or so underneath the tinmyce field so image could be uploaded there if really needed. Sounds from other posts, like you're trying to bend things a little while having all possible (queries, categories, repeaters) that is currently not there and repeaters are maybe an good option to be able to query them. I wouldn't consider repeaters designed for that use, but surely works (apart from not being accessible in a outside repeater text field or from other pages. Depends a little on what exactly we're dealing with here. Products catalogue, news articles, common content/infos? If it where really about meta infos and something like gettyimages, the one image as a page together with meta infos as much as needed would be the way to go. If for articles or news I would consider just using a images field for each category (summary, gallery, details) and upload them separate in a dedicated field. Maybe tradeoff reusablity some for easy, straight forward setup. I would consider giving function meaning by using many images fields, rather than a category select. Especially as in your case the category is "function" and not real meta info. Maybe it can be even mixed with some centralized image content that are pages with collections of images and you can add them to any page through page select field. I would carefully think it out what really matters. Also creatiing a new extended image field that has a pagefield might a good solution too. Works surely better for single image fields as it would for multiple, but in both cases you will always have to set the "category" everytime you replace or upload a new image. There's really a lot that can be considered regarding image management, but I never felt I needed more than there is. Not saying there could be more options for special cases in a image default field. Still maybe a module would be the way to go to give a needed functionality rather than using something that will may limit you later on.
-
How to troubleshoot: non-virtual folders returning PW 404?
Soma replied to MarcC's topic in General Support
Well, I have piwik installed on one PW site but I named the folder analytic. But I'm sure it should be possible to name it piwik. -
How to troubleshoot: non-virtual folders returning PW 404?
Soma replied to MarcC's topic in General Support
The problem might be that the home page template has url segments enabled? -
It's multi language domain translation function. Makes text in templates and modules and admin translateable. http://processwire.com/api/multi-language-support/
-
No its not possible. Kinda very special case. Well u could try making it max levels 3 and hide third level with css and open on click.
-
There's different approaches to how it can be archived. I'm building a shop with products with multiple categories possible. I'll quickly show how it's done. Create template "category" only with a title field. Then build a tree structure that will be hierachical and serve as the navigation. The template need to have urlsegments enabled. That will enable to display products under a category. So the url will be something like /shop/category1/product1/ and in another category the same product /shop/category2/product1/. This will make it easy to have a highlighted navigation. The product template will have fields you need and create them under one separate tree. In that template you add a page reference field "categories" that has set the categories tree parent as parent, and a multiple select to browse and select them. Then this following php code will handle the navigation and rendering of the products. This is in the template for the category template. $prod = null; $nav = $modules->get("MarkupSimpleNavigation"); /* * * If on shop category pages * All category pages use "shop" template * "shop" template has url segments and page numbers enabled * So urlSegment is always the first (1) when browsing the categories * Once the page is of type "product" we use that information to output details * * This most easy setup with navigation and categries nested unlimited * and multiple categories per products * */ if($input->urlSegment1){ // the page is a product? if($pages->get("name=$input->urlSegment1")->template == "product"){ $prod = $pages->get("name=$input->urlSegment1"); $current = $page; } else { // else we get current page $current = $pages->get("name=$input->urlSegment1"); } } else{ // in case we are on a "normal" page, do different stuff $current = $page; } $root = $page->rootParent(); echo "<div style='float:left;width:30%'>"; echo $nav->render(null,$current,$root); echo "</div>"; echo "<div style='float:left;width:68%;margin-left:2%'>"; // detail page if($prod){ echo "<h2>$prod->title</h2>"; echo "<p>$prod->body</p>"; } else { // list page $prods = $pages->find("template=product, categories=$current, sort=title"); foreach($prods as $p){ echo "<p><a href='$page->url$p->name'>$p->title</a></p>"; } } echo "</div>"; There's variations how this can be setup, but this gives a very easy and flexible setup, with a navigation that is highlighted and can have multiple categories for one product.