-
Posts
4,296 -
Joined
-
Last visited
-
Days Won
79
Everything posted by diogo
-
Try this: (not tested) // check the correct url to use on the examples page of the module $.getJSON('/someweb.es/service-pages/?title=toby', function(data) { alert(data.matches[0].name); }); Or for iterating all the matches: (also not tested) $.getJSON('/someweb.es/service-pages/?title=toby', function(data) { $.each(data.matches, function(key,val) { console.log(key + ' -> ' + val.name); // check the console for this one }); }); I'm just adapting from here: http://api.jquery.com/jQuery.getJSON/ Edit: tested and corrected a couple of things
-
What's the idea on these lines? foreach(wire('pages') as $p) { $fieldEnabledPages->addOption($p->name); } Grab all the pages? funny, wire("pages") or even wire("pages")->find() also don't return anything to me (the same happens with $pages on templates, by the way), but wire("pages")->find("sort=sort") does. Maybe you can try that. try: foreach(wire("pages")->find("sort=sort") as $p) { $fieldEnabledPages->addOption($p->name); } Anyway, I'm not sure if it is a good idea to iterate all the pages of the site in a module because it might cause problem on bigger sites.
-
I quickly created a PW inspired color scheme for Sublime Text with this tool http://tmtheme-editor.herokuapp.com/. You can grab it from Github https://github.com/ocorreiododiogo/ProcessWire-SublimeColorScheme Enjoy! edit: I used the beautiful "Gloom" as starting point
-
You can have both
-
For the places you can create a page "places" with countries inside and cities inside them. +places -Angola (template=country) -Brazil -Mozambique +Portugal -Aveiro (template=city) -Beja -Lisbon -Porto When importing from the database you can check for each person entry if the country and the city exists, and create them only if not, and then link this person to the city. You can also link to the country but it's not needed because you can get it like this: $country = $page->city->parent()->title.
-
Coding with Cassius right now. Even the constants are dancing
-
Ryan isn't there any way of "switching the database" on the template to make the api work with one instead of another?
- 12 replies
-
- multiple sites
- multi site
-
(and 3 more)
Tagged with:
-
On another note, maybe you should consider removing the background (or making it much lighter). I really have trouble to read the texts over it. The old cards on the right side are beautiful though
-
In this case I have the feeling you don't have to categorize a lot because events are very independent and dates are automatically categorized already (because there is a sequence). I think you should be more concerned about things like (which musicians were born in my hometown?). You can have those fields as page fields, and create the pages for the existing countries and cites in those countries, to link to. Kongondo wrote a great guide about categorization http://processwire.com/talk/topic/3579-tutorial-approaches-to-categorising-site-content/
-
Yes, it is possible of course. It would look more or less like this: foreach($pages->find("template=person") as $p){ $timeAgo = date("Y") - $p->year; echo "<p><span>{$timeAgo}</span> YEARS AGO - on {$p->weekday} {$p->day} {$p->month} {$p->year}</p>"; echo "<p>(+) {$p->occupation} {$p->lastname} originally {$p->original} aka {$p->alias}, is born in {$p->city}, {$p->country}.</p>"; } Dealing with dates in your case won't be easy because you can't use unix timestamps (starts in 1970). That's why I chose to have all the details from the date in different fields. There might be better ways to deal with this of course. You can also import the database by exporting the database to csv and importing it to PW. This module is great for that http://modules.processwire.com/modules/import-pages-csv/. You will have to plan carefully and build all the structure in PW before.
-
Ryan I just pushed a change to the inputMapMarker.js file on github that solves this problem. Added this inside the InputFieldMarker function: // added by diogo to solve the problem of maps not rendering correctly in hidden elements // trigger a resize on the map when either the tab button or the toggle field bar are pressed $(document).ready(function() { // get the tab element where this map is integrated $tab = $('#_' + $(map.b).closest('.InputfieldFieldsetTabOpen').attr('id')); // get the inputfield where this map is integrated and add the tab to the stack $inputFields = $(map.b).closest('.Inputfield').find('.InputfieldStateToggle').add($tab); $inputFields.on('click',function(){ // give it time to open window.setTimeout(function(){ google.maps.event.trigger(map,'resize'); }, 200); }); }); I had to put it inside the function, to have the "map" variable in scope. I'm not sure how we could move it outside the function if you don't like it that way. Also, the 200 value on the setTimeout works for me (it works above 120 but I set it to 200 to be on the safe side), but we can decide on a safer value depending on other's tests.
-
@rooofl, sorry, I didn't see your questions before. Yes, that's right, you can't have pages previously selected on a page field. What you want would require a module that hooks on page save and selects the page being saved on all the selected pages from the field on that page. Sounds confusing but it's quite simple. $selectedPages = wire($page)->field; foreach($selectedPages as $p){ $thisPage = wire($page); $p->field->add($thisPage); $p->save(); } Written on the browser and I don't have time to make it more complete. Just to give an idea.
-
The post seems to have been deleted. I will restore it. edit: even better, the post was removed because the content was exactly the same. I moved this one to the forum "modules/plugins" instead of restoring the other. Marco I edited your post to remove the link.
-
The page is not indexed if there's nothing linking to it. I would have the links disabled by default at least and the checkbox to enabled them, and maybe the possibility of enabling by template (as you said) or by parent because it makes all the sense to enable all descendants of a page (articles page for instance). Like this, you could enable the links to all the site just by enabling the descendants of home. Or am I complicating?
-
I thought of this already, but gave up on the idea because it allows anyone to start trying random numbers and get pages that you don't want accessible to everyone. One way of avoiding this would vbe to have a global checkbox field that you would have to check to activate the shortlink to that page.
-
Did you remove the title field from those pages?
-
Those are the ID of the pages. My guess is that you chose a field that doesn't exist on the selectable pages as the pages identifier for the dropdown. Go to that field settings, and under the input tab change the "Label field" setting.
-
I updated the README file on github with a troubleshooting section with the solution to this problem https://github.com/ocorreiododiogo/pw-admin-custom-pages/blob/master/README.md
-
Get doesn't build the array in PHP, it just gets the requested page from the database and creates only that object.
-
At the computer now. It would be more efficient if you would do this instead: $urlcat = $pages->get("/categories/")->get("name=$name"); // <- get instead of find echo "<h3>Category: <i>" . $urlcat->title . "</i></h3>"; or this: $urlcat = $pages->get("/categories/$name"); echo "<h3>Category: <i>" . $urlcat->title . "</i></h3>";
-
make sure you sanitize that value before using it in the selector and throw a 404 if the page is not found.
-
You are using a find to get the page. That gives you a page array instead of the page object. for trying, $urlcat->first()->title should do the job, but you should change your find to a get. (on mobile) edit: teppo, not fair, I'm in disadvantage here
-
I changed that immediately after posting. You are too fast for me
-
That line is not from the PW core, but specific to the module. The module adds it on the installation procedure, but for some reason it didn't happen with you.