Wanze
PW-Moderators-
Posts
1,116 -
Joined
-
Last visited
-
Days Won
10
Everything posted by Wanze
-
I remember ryan saying that the questionmark indicates the error happened before Pw could handle the request. So I guess this means that the DB-error happens right at the beginning and Pw isn't able to detect the user or the page, because it can't access the database.
-
No problem. Can't help anymore, you should open the javascript console and reload the page. The console will report if there are any js errors. If you don't know how to fix please post the error message.
-
Without emulating $imgArray = $images->getArray(); natsort($imgArray); // continue with $imgArray or... $images = new WireArray(); $images->import($imgArray); Not tested
-
@Basil Open your javascript console and check for errors. In your posted code there's one comma too much: <?php echo $page->map->lng ?>, /*remove this comma*/ Cheers
-
How do I get connected page's custom field value?
Wanze replied to Vineet Sawant's topic in Getting Started
adrian's right. But why can one theatre belong to multiple cities? -
How do I get connected page's custom field value?
Wanze replied to Vineet Sawant's topic in Getting Started
Ah theatre_city is a Page field and not a Text. Then you can write: echo $t->theatre_city->title; -
How do I get connected page's custom field value?
Wanze replied to Vineet Sawant's topic in Getting Started
$theatresIds is a string with the Id's of your theatres. You can't use foreach to iterate over a string. That's why we first need to get the theatre pages with those ids: $theatresIds = $page->drama_theatres; // Get the theatre pages $theatres = $pages->find("template=theatre, id={$theatresIds}"); Next step is to make sure we have found some pages: if (count($theatres)) { foreach ($theatres as $t) { echo $t->theatre_city; } } else { echo "No theatres found"; Are your theatre pages hidden? -
How do I get connected page's custom field value?
Wanze replied to Vineet Sawant's topic in Getting Started
Ok let's find out why The field "drama_theatres" can hold multiple theatres pages, is this correct? To start debugging, you could output some values and check them. For example: $theatresIds = $page->drama_theatres; echo $theatresIds; //Should outputting some ids like 1343|1345|1234 -
How do I get connected page's custom field value?
Wanze replied to Vineet Sawant's topic in Getting Started
Hi vineonardo Do you mean this? // In Template drama // Get all theatres foreach ($page->drama_theatres as $theatre) { echo $theatre->theatre_city; } -
Hi titanium, You could do a redirect to "start" or output the same content as the start page. So in your home template: $p = $pages->get('/')->children('name=start'); if ($p->id) { // Redirect $session->redirect($p->url); // or render the start page echo $p->render(); } May I ask you why you need this behaviour? The second option is not good for SEO, because you have two urls with the same content.
-
WillyC - thanks
-
the sort field in the pages table isn't "unsigned", so negative values should be possible.
-
Hi pestagouris I don't see the benefit? Problems: 1. What about $field->collapsed, $field->notes? You'd need new keys 2. What if you want to call a method on the Inputfield after creating it and before adding it to the Wrapper? You can't because you don't create the objects anymore.
-
That's an "easy" task in Pw because you don't have to write SQL but find your stuff with selectors. Basically you just throw your data that was sent with the selects in a Pw selector to get your pages: // In template (HTML) <form method="GET" action="<?= $page->url ?>"> <select name="gender"> //.. options </select> <select name="color_hair"> //.. options </select> <select name="age"> //.. options </select> </form> // In template, above output if (count($input->get)) { // Get the criteria and sanitize them $gender = $sanitizer->selectorValue($input->get->gender); $color_hair = $sanitizer->selectorValue($input->get->color_hair); $age = $sanitizer->selectorValue($input->get->age); // Search pages $p = $pages->find("template=user, gender=$gender, color_hair=$color_hair, age=$age"); } This is a simple example. If you have some select fields optional, you'd need simple logic to check if the data was sent. And just add it to the selector if the user submitted the criteria.
-
Hi jmart, You could go with an autoload module that hooks into Pages::___delete() I'd write the array with the id's in /site/config.php This is just an example - not tested. Maybe there exists more elegant solutions? //... in your autoload module public function init() { $this->pages->addHookBefore('delete', $this, 'checkDelete'); } public funciton checkDelete($event) { $page = $event->arguments[0]; $id = $page->id; if (in_array($id, $this->config->doNotDeleteArray)) { throw new WireException("Sorry but you can't delete this page!"); } }
-
I think the easiest queries you can build with a template structure that is the following: Template artist - title - genre (Page field with template genre) - other metadata from artist Template album - title - artist (Page field with template artist) - cover (image) Template track - title - tracknumber - tracklength - file (mp3) - album (Page field with template album) Template genre - title This way, you have all your pages on a separate "branch" in your tree - but the data is related through page fields. +Artists --+ artist1 --+ artist2 +Albums --+ album1 --+ album2 +Tracks --+ track1 --+ track2 +Genres --+ genre1 --+ genre2 Sample queries: // Search for artists $artists = $pages->find("template=artist, title=Metallica|Queens of the Stone Age"); // Search 50 random tracks by artists with genre Rock $genre = $pages->get("template=genre, title=Rock"); $artists = $pages->find("template=artist, genre=$genre"); //If you have lot's of artists, you should limit here too and select random artists $tracks = $pages->find("template=track, artist=$artists, sort=random, limit=50"); // Get all albums of an artist $albums = $pages->find("template=album, artist.title=Dieter Bohlen") The issue with the track that doesn't belong to an album could be solved by creating an album "unknown" per artist and reference this album in the track. Did I already say that I love ProcessWire?
-
The problem if you store everything in one template: You have redundant data. For example: You store the same album title 11 times if you have 11 tracks. If you have 120 tracks of the same artist, you will store the artist 120 times in a text field. What happens if the band changes their name? Maybe not a good example, but in a relational database you should (almost) never store redundant data. Can you explain or give some examples what kind of queries you want to do? Maybe this helps us further how to structure the data.
-
Hi horst, my suggestion: Template artist - title - other metadata from artist Template album - title - artist (Page field with template artist) - cover (image) Template song - title - tracknumber - album (Page field with template album) If a song/track doesn't have an album, you can leave the album page field empty. EDIT: Just noticed that when a song doesn't belong to an album, you cannot get the artist. So maybe adding the artist field also to song? Hmm... let me think again Possible solution here Another possible way is to organize over the page tree: - Artists (artists) --+ artist1 (artist) ----+ Albums (albums) ------+ album1 (album) ---------+ song1 (track) ---------+ song2 (track) ------+ album2 (album) ---------+ song1 (track) .... ----+ Songs (songs) ------+ song_that_does_not_belong_to_album (song) --+ artist2 (artist) .... Depends on the search queries. Organizing this way you don't need page reference fields. Searches are then over parents/childrens.
-
I've also read the whole thread. I think this is a move in the wrong direction for modx. Started with modx evo and then used revo - until I discovered ProcessWire. Btw. amazing post here from einsteinsboi ( do I correctly remember seeing him her also in this forum? ) http://forums.modx.com/thread/83497/modx-core-development-team-abandoning-modx-please-read?page=16#dis-post-462193 I can't imagine that something similair is ever going to happen with ProcessWire
-
Horst - thanks! Never heard of the FPDI extension. I checked your link and read some docs on the website, but I'm not sure how this should be integrated here. Can you give me more details? What do you mean with "background"? As far as I understand, FPDI is used to import pages from other pdf's into your pdf. Grüsse nach Deutschland!
-
Tested? I added a space after the keywords in my selector for this cases
-
The password is salted. Try to use the same hash in $config->userAuthSalt as from your clone site. Please keep the current hash too (uncomment), because I don't know your excat setup.
-
Hi evan, maybe this does work? $pages->find('!title^=the |an |a , sort=title'); Just an idea. There are some limits on the length of words, i'm not an expert here. If it doesn't work, I'd go with the array.
-
Thanks manviny! If you have ideas for improvements, please share. Haven't used the module myself actually Cheers
-
http://www.pwpw.pw PowerWithProcessWire !!