Jump to content

bwakad

Members
  • Posts

    450
  • Joined

  • Last visited

Everything posted by bwakad

  1. Actually it was in response to your question asking me if I had any pages for this second field, but of course then nobody see what's inside. My mistake. The first select I described, has no problems. If I simply leave the default value out, it will display as the 2nd image attached. I just can't get the second select to start width (with at least a value or blank).
  2. Thanks, I already rolled back to the basics - and on the other side still making some neat changes on skyscrapers (other vhost). I did not fully understand the render - what exactly does it do, from the description it does not tell me. It is used often in templates, but it states to do markup by yourself: A relevant example in this case is the MarkupPageArray plugin module, which is installed by default and adds a render() function to all fields that return a PageArray (as many functions in ProcessWire do). So a shortcut to the above example could be: <?php echo $page->children->render(); ?> In most cases, I recommend that you generate the markup yourself rather than using plugins to do it for you... especially when getting started. That way you will get a better understanding of the API and more control over your markup.
  3. see attached image... root - location - - province1 - - - municipal1 - - - municipal2 - - province2 - - - municipal3 - - - municipal4 etc. the field province has parent page location the field municipal has a custom selector parent=page.province
  4. Okay, so - how to I solve this? The first select (province): regular selectable pages: parent page = location accepts: page=ID as default value The second select municipal: custom selectable pages: parent = page.province accepts no default value As a result, the first select has a value by default, but to populate the second one, I first need to switch to another choice. Or I leave the first on blank by default, but still the second one is not populated and therefore very small. This issue (see image) causing the second select to be very small to start with. And I do not know how to make the selectbox more width, or invinsible until a choice is present in the first.
  5. I am having a hard time find information about setting a default value in the backend at a select for pages. I tried : page=ID fieldname=ID I have looked in the API and all, but could not find specifics on Default Value
  6. So... after reading this, assuming my field is: myfield $fields->get("myfield"); $page->template->fields->myfield; $page->get("myfield"); $page->myfield; all basically get the same result? for example: (string) $field; // is not clear to me, must I use <php? (string) $field; ?> And yes, all are right, I need to go through those docs, but how to match what you learn to understand the cheatsheet? I know what a string, variable, array is. But an object???
  7. It might be me - and for people who know - this may sound stupid, but I would like to have a little more information about the API/Cheatsheet and how to use this. As an example: $fields->get("name"); I think I have to use it as this: echo $fields->get("select_province"); // returns me the name of the field as in the back-end configured echo $fields->get(select_province); // returns me the name of the field as in the back-end configured So basically the same But looking further... $fields->get("selector"); // no idea what to do here (string) $field; // no idea what to do here $field->get($key); // no idea what to do here $field->set($key, $value); // no idea what to do here Inside "selector" - do I need to make something as : $pages->find ....? inside (string) - do I need to place a text or something? what does $key and $value represents, or do I need to replace that with something? Is $fields, $pages, $page - predifined? and is for example "selector" and $key not predifined? And this goes on and on, since I can not really find an explenation of what you have to fill in, and in which part, or how to use those. While I am trying to understand and learn, a redirection to this cheatsheet is simply not much help. Basically I am saying to also consider people who have no clue and try to learn.
  8. thats funny, but no homework without lessons - no lessons without teachers.
  9. Page-Template code: $address = $page->select_province->title.' '.$page->select_city->title; $address = urlencode($address); $request_url = "http://maps.googleapis.com/maps/api/geocode/xml?address=".$address."&sensor=true"; $xml = simplexml_load_file($request_url) or die("url not loading"); $status = $xml->status; if ($status=="OK") { $Lat = $xml->result->geometry->location->lat; $Lon = $xml->result->geometry->location->lng; $Location = "$Lat,$Lon"; echo $Location; // here I get back latitude, longitude which are exactly right... } >>> error here <<< $map = $modules->get('MarkupGoogleMap'); echo $map->render($Location,'location_map'); ps. I don't know how to get those two fields in the $address in a short way... // and the error says: Error: Call to a member function first() on a non-object line 175 from MarkupGoogleMap.module $marker = $pageArray->first()->get($fieldName); The only thing I could find on internet was it has something to do with a name not in DB, but I really need some more explenation... I suspect it to be $marker versus $Location... can anyone tell me???
  10. Because $cck resides from seblod and $page (in template) is current page viewed. I find the api a litle hard (learning php and PW), e.g. if I look at some code (even with a default install): $page->get->fieldname $page->fieldname $str = wire('sanitizer')->selectorValue($page->title); $out = "\n<ul class='skyscraper_images'>"; sometimes I see ->fieldname, and other times ('fieldname') p.s. Learning is asking, and get respons which helps - Now, It's like getting a direction to school, but inside there are no teachers - and as such, no-one will learn.
  11. I noticed in a topic on seblod, (gebeer) about this module - this code which should create a override in the template for the location, but how would this work for processwire. I am guessing that $cck would be $page, since it retrieves from the current page. There would probably also be some xml file present? //from seblod topic $strasse = $cck->get( 'yourstreetfield' )->value; $plz = $cck->get( 'yourplzfield' )->value; $ort = $cck->get( 'city' )->value; $bundesland = $cck->get( 'province' )->value; $land = $cck->get( 'impressum_land' )->value; $address = $strasse.' '.$plz.' '.$ort; $address = urlencode($address); $request_url = "http://maps.googleapis.com/maps/api/geocode/xml?address=".$address."&sensor=true"; $xml = simplexml_load_file($request_url) or die("url not loading"); $status = $xml->status; if ($status=="OK") { $Lat = $xml->result->geometry->location->lat; $Lon = $xml->result->geometry->location->lng; $LatLng = "$Lat,$Lon"; echo $LatLng; }
  12. fields: select_province, select_city This code seems to work for the markers of pages, where address was filled in: $items = $pages->find("template=basic-page, location_map!='', sort=title"); $map = $modules->get('MarkupGoogleMap'); echo $map->render($items, 'location_map'); Should there not be something for : $items = $page->get("???=select_province, location_map!='', sort=title"); Yes, I know it's wrong, just thinking out loud...
  13. Just want to know if the map on a template file can fetch field values. Example fields: select_province select_city street address from module becomes either: A: select_province B: select_province, select_city C: select_province, select_city, street Obviously this should then output the map.
  14. Okay - I checked settings for this last field... it turns out it was set to multi page array. After changing to single page (null) it will at least accept changes. I did install a fresh DEV-branch and work from that. Just so things are more readable for now. But now a new problem: that I need to save one time for 'province' to be written to DB, and another time for 'city'. Even though I made it in one change - I have to save two times.... Solved (see fields section) Page levels from root: - about - location - - province-one - - - city-one - - - city-two - - province-two - - - city-three - - - city-four Since they are used for selects, I just created their templates without a file. e.g. location, province, city. I also made 2 fields: select_province, select_city. select_province type = page dereference = single/null required = yes default value = 1015 = id province-one selectable pages parent = location input field type = select select_city type = page dereference = single/null required = yes show this field only if = select_province!='' custom selector = parent=page.select_province input field type = select I added these 2 fields on the template (basic-page), and when I edit about (basic-page) and select a province, I get their respective cities in select_city and select one there. When opening the page where this fields are added (on-load), if it was a new page where fields would be empty - it will have a populated select_province, and also a select_city; if it was filled in before - have a chosen select_province, and also a chosen select_city. Does anyone have suggestions to make it better? Like maybe a default value as a text?
  15. the one I forgot in here, : <img src="<?=$page->article_images->first()->url ?>">
  16. yeah, I changed that too, just like the question mark I had to add for the first image <?=?page But to tell you the thruth, it's a good practise to do anyway. And by the way - I took your advise to start from scratch with a normal installation without site profile and are hoping everything works (later on).
  17. I tried to replicate the tutorial for practise and noticed In the part for TUT_article: You suddenly split the field article_images into article_mainimage and article_secondimage.... And article_metadescription became article_meta_keywords.... Or is the part from before the (where you created those fields) not correct? I also don't think this should work in the tut_header.inc <meta name="description" content="<?=$pages->get("/site-settings/")->site_meta_description ?>, <?=$page->article_metadescription ?>">
  18. The fields province and municipal are related to eachother and both placed on the skyscraper template. When I go in a page which is (for now) cities > city > item, I can select a province, and in the municipal it give me a municipal list to select. But I can't save !!! because of the warning I mentioned in the topic. And I do not know where to look for this ... The Page ID number IS the municipal page. pages - cities - - city - - - item - provinces - - province (makes up the select for province field) - - - municipal (makes up the select for municipal field) cities with cities index template, and provinces with provinces index city with city template, and province with province template item with skyscraper template, and municipal with skyscraper template (they use same)
  19. would those be from those sites? ... you know ...
  20. I was just thinking, it would be nice if one has many pages to search for, how to make an alpha index on template file for front-end. Only displaying "A" if there are items under the parent starting with "A" in their names... Well, that is something to think about later... off to bed.
  21. Wordpress, Joomla, OSClass - and especially combined with templates - which sometimes have, yet, another framework - combined with plugins/extensions. I was eventually happy with them, until I installed those 'extra's' that make it hard to maintain structure / output / css. I really don't even know where I saw someone mentioning about PW, but after some days playing with it, I really start to see the potentials of it. I just hope it will be here for a long time!
  22. Yeah, I know what you mean... was just strange to me - coming from other cms you know. PW is really amazing!
  23. This puzzles me, if I sort pages based on created date, I would expect ID numbers to be Ascending.... My tree pages almost qualify for this, except I see: 74 80 94 85 102 105 How are ID's handled by PW? I assume, even with large imports, the creation date - would also run in same order as ID does.... very strange! Or could it be that some are INSERTED in database???
  24. it said, "you are not allowed to move pages in /page-name/", I don't know about the permission because I am allowed to create pages.
  25. I am curious, how many users are on PW - or in general using this software?
×
×
  • Create New...