Jump to content

MuchDev

Members
  • Posts

    378
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MuchDev

  1. Hey thanks I've definitely spent some time googlin but that final link held the answer. I've not seen that part of the cheatsheet, thanks for the link ! K so I am going to use setLimit('x') perfect! So happy.
  2. Hello, I'm back . So I am currently doing some more work on a template that holds virtual exhibitions for my gallery project. The way that the template currently functions like so. An exhibition contains artworks and artwork sections. The artwork can either be a child of the page, a child of a subsection (when this happens there will be a page division and headline text), or it can be specifically chosen via a multipage selector inside of the template. What I would like to do is implement pagination into this. Currently I grab all children items by using a selector , and then combine everything from the pagefield to a variable $items by executing $items->import. Is there a simple way to limit the items displayed once everything has been combined. Something like $items("limit=35")? This is my current logic: if ($page->Artwork_in_Inventory){ $inventoryItems = $page->Artwork_in_Inventory; } $items = $inventoryItems; $items->import($page->children);
  3. I have broken my pages many times forgetting whether I have set the field to single or multiple, cool to see that the api is expanding to fix this .
  4. Hey thank you guys so I got it. Every solution I ever have come right about when Im falling asleep. It turns out I have a script that that clears the form when the modal closes but when you submit the modal closes before post is done processing. Total noob mistake, I just removed the form clear from submit click and it worked $(document).ready(function(){ $('#submitQuestion').on('click',function(){ document.getElementById("contact").reset(); }); $('#contactModal').on('hidden.bs.modal', function (e) { document.getElementById("contact").reset(); }); }); So the email was sending perfectly just without any form values that were entered. I guess I forgot about the fact that I used a redirect on send also.
  5. Well I got this form done a while ago and am trying to debug why all the sudden it's not submitting any values for name,email,tel, and comments. I used soma's code to do this and its great but I thought someone might see the answer hidden in here. Thanks in advance for helping me out <div class="modal fade" id="contactModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <!--p id="id2" name = "id2" style="display:none;"></p>--> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4>Inquiry</h4></br> </div> <div class="modal-body"> <?php $sent = false; $contactEmail = $page->parent->Employee_Email; if ($page->parent->path == "/exhibitions/contemporary/"){ $contactEmail = $pages->get(1248)->Employee_Email; } if ($page->parent->path == "/exhibitions/antique/"){ $contactEmail = $pages->get(1249)->Employee_Email; } if ($page->parent->path == "/exhibitions/modern/"){ $contactEmail = $pages->get(1250)->Employee_Email; } // sanitize form values or create empty $form = array( 'fullname' => $sanitizer->text($input->post->fullname), 'email' => $sanitizer->email($input->post->email), 'tel' => $sanitizer->text($input->post->tel), 'url' => $page->httpUrl, 'comments' => $sanitizer->text($input->post->comments), ); // check if the form was submitted if($input->post->submit) { $artid = $input->post->artinfo; $artwork = $pages->get($artid); $artinfo = "Artist: " . $sanitizer->text($artwork->parent->artist_firstname); $artinfo .= " " . $sanitizer->text($artwork->parent->artist_lastname) . "\n"; $artinfo .= "Title: " . $sanitizer->text($artwork->title); //foreach($form as $key => $value) { // if ($key != 'tel'){ // if( strlen(trim($value)) == 0 ) { // $error = true; // break; // } // } //} // if no errors, email the form results if($input->post->url == "" && !$error) { $msg = "Full name: $form[fullname] \n" . "Email: $form[email] \n" . "Phone: $form[tel] \n" . "URL: $form[url] \n\n" . "-------------------\n\n" . "$artinfo" . "\n\n-------------------\n\n" . "Message: $form[comments]"; mail($contactEmail,"Website Inquiry", $msg, "From: notifier@davidsongalleries.com"); $session->redirect("./", false); $mailed = true; } } if(!$sent) { // sanitize values for placement in markup foreach($form as $key => $value) { $form[$key] = htmlentities($value, ENT_QUOTES, "UTF-8"); } // append form to body copy echo <<< _OUT <form id="contact" action="./" method="post"> <p> <label for="fullname">Your Name</label><span class="error">( required )</span> <input id="contact_fullname" class="form-control required" type="text" name="fullname" value="$form[fullname]" /> </p> <p class = "antispam"> <input class="nc" type="text" name="url" value = ""> </p> <p> <label for="email">Your Email</label><span class="error">( required )</span> <input id="contact_email" class="form-control required" type="email" name="email" value="$form[email]" /> </p> <p> <label for="tel">Your Phone Number (Optional)</label><br /> <input class="form-control nc" type="tel" name="tel" value="$form[tel]" placeholder="Enter phone number only if you wish to be called about this inquiry" /> </p> <p> <label for="comments">Comments</label><span class="error">( required )</span> <textarea id="contact_comments" class="form-control required" rows="10" name="comments">$form[comments]</textarea> </p> <!-- field to hold the art information--> <p class = "emailartinfo"> <input type="text" class="form-control nc" name="artinfo" id="sendartinfo" value=""> </input> </p> <p></p> _OUT; } ?> </div> <div class="modal-footer"> <input id="submitQuestion" class="btn btn-default" type="submit" name="submit" value="submit" /> <a href="#" class="btn btn-default" data-dismiss="modal">Cancel</a> </div> </form> </div> </div> </div>
  6. Well the formatting got a little weird in the code box as they are really long links but just throw em in a text editor and you should be right as rain. I managed to find some sample code that allows you to use the pinterest image chooser as is an important thing for this project. Now just to get it out of the document into my extra js. function renderSocial(){ $soc = ''; $page = wire('page'); $thisUrl = $page->httpUrl; $path = wire('config')->urls->templates.'img/'; $lnkDesc = $page-meta_description; $friendlyUrl = urlencode($thisUrl); $friendlyDesc = ereg_replace("[-]+", "-", ereg_replace("[^a-z0-9-]", "",strtolower( str_replace(" ", "-", $lnkDesc) ) ) ); $soc .= '<div class="socialHolder">'; $soc .= ' <ul class="share-buttons">'; $soc .= ' <li><a class="socialBtn" href="https://www.facebook.com/sharer/sharer.php?u='.$friendlyUrl.'&t='.$linkTitle.'" target="_blank"><img src="'.$path.'Facebook.png"></a></li>'; $soc .= ' <li><a class="socialBtn" href="https://twitter.com/intent/tweet?source='.$friendlyUrl.'&text='.$thisUrl.'Your Title Header:'.$page->title.' '.$friendlyDesc.'" target="_blank" title="Tweet"><img src="'.$path.'Twitter.png"></a></li>'; $soc .= ' <li><a class="socialBtn" href="https://plus.google.com/share?url='.$friendlyUrl.'" target="_blank" title="Share on Google+"><img src="'.$path.'Google+.png"></a></li>'; $soc .= ' <li><a class="socialBtn" href="javascript:void((function()%7Bvar%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','http://assets.pinterest.com/js/pinmarklet.js?r='+Math.random()*99999999);document.body.appendChild(e)%7D)());"><img src="'.$path.'Pinterest.png"></a>'; $soc .= ' </ul>'; $soc .= '</div>'; echo $soc; }
  7. Well here I go, I've got something now. Just a little social bar function ill post it once it's done. You will need to track down some extra documentation on meta tags if you dont already know but I should have a little inc file done in a bit:). One thing I am interested in is in how I should go about making the url friendly for the facebook sharer php link and such. Is it ok to use / in urls or should I try and do some extra work to substitute the characters?
  8. Hey guys, I am strugling to get a decent spread of social share buttons on my page that doesn't totally bog everything down. I had addthis which ended up adding 2sec to page load (even when loaded asynchronously) and sharethis(which just would totally break constantly), and then I decided to just write links in php without all of their api overhead. What I was wondering is does anyone have a function that they have written already that has facebook,twitter,g+,and pinterest so I dont have to spend yet another day fussing with ugly social media documentation? http://www.sitepoint.com/social-media-button-links/ This page has a pretty nice walkthrough I was thinking I would adapt. There has to be some brilliant pw dev out there that has some slick social share button module. **Just found oEmbed. I read about that before but didn't understand what it actually does, is this something I should figure out?
  9. Well I got some great results due to your awesome assistance. Now I have a monthly, and yearly display that runs off one single date field. Thanks again
  10. I do agree that pure php functions don't belong, that is what their documentation is for. More I was just casually musing on processwire's implementation of the date time field as the only real information is the description on the module itself refering the user to php's documentation without any samples of the syntax. I suppose though the function is exactly the same it makes sense. Now I understand Anyway Im just going to unformat the fields and talk to them with php as I will most likely be needing the ability to display the date in many different formats. You guys are total life savers.
  11. You guys totally nailed it, I had formatting and didnt think about the whole unix timestamping! I now understand a lot more about how that datetime field works. So many code options, now I can use formatting and still use the field to grab specific parts of the date. **edit ** for some reason what I said came out snarky This might be really helpful if it made it's way to the cheat sheet is what I meant.
  12. Thanks as always! Sorry for cloggin up the airwaves. Im not getting anything out of that code, but I'll keep tinkering.
  13. So I can't seem to find the full documentation on the datetime field and was wondering how I would go about formatting the output via the api. If i were to echo $page->date I get the date perfectly. What I would like to do is in some instances just grab a month day or year so that I could run loops that print different info on the page in an archive. I have found some complicated code that I didn't entirely understand and the documentation from the field didn't seem to have what I needed. Is there some way I could just do something like echo $page->date('Month-Year'); //or better yet $month = $page->date('month'); $year = $page->date('year');
  14. Thanks again reems I really appreciate you stickin with me on this one. I think I may have a little reprise as I am first going to send the data out to a fellow student of mine who is pretty talented with scripting and sql and see if he can find any patterns in it. If he can then I'm just going to buy him pizzas until he's done, if not then I get to set a couple days out with excel and see if I can get it all dealt with. In reference to the page field stuff I have a feeling it will actually be pretty straight forward, page fields just hold a string with the page path. So if this is the case then all I will need to do is format the text as if it were the page path itself. Then when you upload just make sure that the string is correct and it hopefully should map. I wonder if anyone reading this knows, I know I will very soon.
  15. Totally loving that this module exists, I am about to push a ton of new data to a site that I am live developing and I really dont want it to get picked up by any nosey search engines. I have to say though the first thing I did to make it usable was delete the line of code that said "This site is in maintenance mode" as it was sitting right over the top of my navigation. I would say if you are going to have fixed positioning I personally would like it at the bottom, or even the ability to change the code via a field. Maybe even a custom code box or something along those lines. All in all though this module is a life saver and thank you for releasing it
  16. Eh its fine. It is away from where I was bringing the topic but not where it was earlier. Just happy to have some posts in here, maybe it will make others read it and give me lots of usefull advice
  17. Ok so I managed to wrangle the first set of about 7000 records. Now I feel as if I am staring into the abyss. I am not expecting anyone to chime in but given the expertise already displayed I figured posting here couldn't hurt. So I now have about 1700 more records left, but I fear these will be the worst of it. Below is a chunk that I rough parsed just for importing into excel (using pipe delimiters) . The data below fits a pattern but throughout the data set there is a whole pile of incorrectly mapped fields around 3000 or so is my guess. Does anyone have any experience with any tools that would be able to analyze this crud? hasui-32319.jpg | Kawase Hasui (Japanese, 1883-1957) | Snow at Hie Shrine (Shatō no yuki (Hie jinja)) | Color woodblock, 1931. Hasui signature in the plate. Artist seal. Watanabe seal. Ref: Hotei 242 | Oban tate-e | hasui-32320.jpg | Kawase Hasui (Japanese, 1883-1957) | Tamon temple, Hamahagi, Bōshū (Bōshū Hamagahi Tamonji) | Color woodblock, 1934. Hasui signature in the plate. Artist seal. Watanabe seal. Ref: Hotei 349 | Oban tate-e | hasui-32321.jpg | Kawase Hasui (Japanese, 1883-1957) | Zensetsu temple, Sanshu (Sanshū Zensetsūji) | From COLLECTION OF SCENIC VIEWS OF JAPAN II, Kansai edition. Color woodblock, 1937. Hasui signature in the plate. Ref.: Hotei 334. Tape residue top and bottom margins | Ōban tate-e | [32321c] | '); hasui-32322.jpg | Kawase Hasui (Japanese, 1883-1957) | Cherry Blossoms at Yasukuni Shrine, Tokyo | Color woodblock, 1936. Hasui seal. Watanabe seal. Ref: Hotei Hb-s1 | 6-3/4 x 4-12 inches | hasui-32323.jpg | Kawase Hasui (Japanese, 1883-1957) | Hachiman Shrine, Kamakura | Color woodblock, 1936. Hasui seal. Ref: Hotei Hb-s10 | 6-3/4 x 4-12 inches | hasui-32324.jpg | Kawase Hasui (Japanese, 1883-1957) | Snow at Miyajima shrine | Color woodblock, ca. 1930s. Hasui seal. Ref: Hotei Hp-55 | 5-7/8 x 3-3/4 inches | hasui-32325.jpg | Kawase Hasui (Japanese, 1883-1957) | Chūzen Temple, Utagahama (Chūzenji Utagahama) | Color woodblock, ca. 1930s. Hasui seal. Ref: Hotei Hp-50 | 5-7/8 x 3-3/4 inches | hasui-42501.jpg | Kawase Hasui (Japanese, 1883-1957) | Sakurada Gate (Sakuradamon) | From <u>Twenty Views of Tokyo</u>. Color woodblock, 1928. Ref.: Hotei 156. A postwar impression. Watanabe seal in lower left | Oban yoko-e | hasui-42565.jpg | Kawase Hasui (Japanese, 1883-1957) | Evening snow at Terajima village (Yuki ni fururu Terajima mura) | From <u>Twelve Scenes of Tokyo</u>. Color woodblock, 1920. Hasui signature in the plate. Artist seal. Watanabe seal. Ref: Hotei 35 | Oban tate-e. Trimmed margins |
  18. Yeah I like it, frankly I'd like to see some more options beyond list and grid to boot. Like either a drag bar or option to set an arbitrary width on the thumbnail. I'd take a look if you made a module
  19. Is this code you used or wrote yourself. I would love to add a little bit on top of the honey pot we used.
  20. Sorry for some reason alerts did not show up for me on this one. You get it figured out? Looks like you are pointing that method to an object that doesnt have an image is my guess. Did you maybe change the field to max of 1 image? In that case I know you wouldn't need ->first() as that function just pulls the first in an array. Also I would read up on find() as you could probably locate those pages a little easier that way.
  21. Thanks reems. You got it right away. The formatting is indeed this bad throughout the entire data set. Using some regex and excel I have managed to get things better, but they are still a ways off. I have a friend that is also in the computer science program that I am attending who is a bit better with db / vb. I hope to get him on board, but when labor is free you can't be in too much of a hurry. So at this point I am just chugging through the framework of the site while I wait on the data itself, which I think is one reason why I am messing some things up. Don't worry I wasn't planning on pointing pw to that junk quite yet . Yeah its still a mystery if I should use some more page fields, but I am thinking I can use the skyscraper example to build out a pretty good search with some help from another buddy. Hopefully I get a little more feedback but We'll see I guess.
  22. Sorry been away for the day but these are both great options. I really like the Google Webmasters option. I think ill look into that. Thanks for the advice:)
  23. Sorry it wasn't clear I think I am unintentionally being vague because this part of the project kind of scares me . So this data is coming in the form of text that I have parsed out of manually entered php files. Their website is set up in a way that an item is little more than echoing a string from a simple php function. So one arwork looks like this artinfo('sato-plum.jpg','Takahiro Sato','Plum','Mezzotint, 2006. 4/50','3 x 5 inches','$195','sato'); Now imagine 500 or so pages with that function. That is where I am getting the data. For this reason I am choosing to go with more fields as there will be an unfortunate amount of non-normal data. In some cases you will see a function defined like above. Other times fields would contain different formatting. Ie dimensions can be defined like 3 x 5 inches or 3'' x 5'' or 3in by 5in.
×
×
  • Create New...