-
Posts
2,778 -
Joined
-
Last visited
-
Days Won
40
Everything posted by Macrura
-
that's cool - didn't know you could request fc transactions via curl.. not sure why the code i posted didn't work for you though - i tested by re-feeding transactions from FC and was eventually able to have it reply with success and also it was successfully updating the processwire page (in my case decrementing the inventory)// did you include all of the scripts; // get these from http://modx.com/extras/package/foxycartinventory $rc4cryptPath = "/path/to/class.rc4crypt.php"; $xmlParserPath = "/path/to/class.xmlparser_php5.php"; i also have datafeed log working but commented out, since it's only needed for testing... anyway thanks for posting your solution, that could be useful at some point in the future...
-
depends on where your opening php tag is, and this is not php comment <!-- use brackets then your editor can show you the matching bracket <?php foreach ($entries as $entry) { ?> <p><?=$entry->name_1;?></p> <p><?=$entry->description_1;?></p> <? } ?>
-
i use this a lot: http://processwire.com/talk/topic/3429-how-to-set-text-linecharacter-limits-in-templates/?p=33779
-
joss - you can basically do this by creating a text field and then use a tab field (FieldsetTabOpen); you could further enhance it by disabling editing of that field by permission
-
@martijn - cool, yeah i've done some similar things like that, but your suggestion is really good for having all the settings for each slide layer in it's own little textarea; each slide is a page and then i could use a repeater for each slide layer and then have a text box for style attributes which control the animation... still doesn't really solve the putting of php directly into the editor though... i've seen plugins for other cms that enable one to put php into text area, one that i remember using a lot was sourcerer from nonumber.nl
-
@martijn, renobird, matthew - here's a question - i have a site using layerslider which has tons of configuration options for each slide; it would be hard to provide those various settings as fields; i tried using Ace code editor for the client so they can make changes to the images and text, but in one of the slides i'm pulling data from processwire pages and need to use php... so i abandoned the idea of using the ace editor for now, but wondering if there is a way to do this currently in a simple way... maybe enable hanna code textformatter in the ace editor and then make a hanna code for the various things that need php...
-
great - that's cool that this is working...!
-
yes - that would work for the events themselves; but before you start foreaching through the month's events, if you wanted to for example output headers for each month, you could also use the existing $month variable and then strtotime it to get your month name, or use the switch..
-
yeah - should probably do that - cheers! also - once you start setting up your markup for output, there are some things you can do to get the month names to output how you want (instead of numbers), usually done using php built in strtotime http://php.net/manual/en/function.strtotime.php , so you can pass the month as a string and then format it any way you want once you tell php that it's a date; http://www.php.net/manual/en/datetime.formats.date.php; since you are sorting by the month number, so those will appear in the right order; the last project i did i needed to customize the output of the day names, so i used a switch statement in the loop, something similar for this, in case you don't want to use the php date: <?php switch ($month) { case 01: $monthName = "January"; break; case 02: $monthName = "February"; break; // etc.. }
-
there were a bunch of mistakes in the first code, with the wrong var names in the nested loops, that's why it wasn't working, and i moved one line; the comments should tell the story though
-
hey Joss - maybe see if this is better... still untested: <? function events() { // get all of the events $events = wire("page")->events; //gets the repeater field $years = array(); $out =""; // find the array of years for all events foreach ($events as $event) { $years[]= date("Y", $event->getUnformatted("event_start_time")); // add properties event_year and event_month to the $event object $event->event_year = date("Y", $event->getUnformatted("event_start_time")); $event->event_month = date("m", $event->getUnformatted("event_start_time")); } $years = array_unique($years); asort($years); // for testing // print_r($years); // print_r($events); foreach($years as $key => $year) { // Output the year $out .="<h2>{$year}</h2>"; // find the array of events this year and put into new array $year_events $year_events = $events->find("event_year=$year"); // print_r($year_events); // loop through the events for this year and add the months to the array $months = array(); foreach ($year_events as $year_event) { $months[]= date("m", $year_event->getUnformatted("event_start_time")); } $months = array_unique($months); asort($months); // print_r($months); // loop through the months and find events for the month foreach($months as $key => $month) { // Output the month as a number $out .="<h3>{$month}</h3>"; // filter only the events for this month, from the $year_events array. $month_events = $year_events->find("event_month=$month"); // print_r($month_events); foreach($month_events as $e) { $out .="<p>{$e->event_who}</p>"; } // end foreach events for this month } // end foreach months } // end foreach years echo $out; } ?> *maybe joss or a moderator could mark this as best answer?
-
the great thing about having this logo as an icomoon font would be that you could easily change the color and size without having to generate any images, so some sites where the footer is dark, the logo could be light grey or whatever color to match the site...
-
Joss - maybe try echoing the count of month_events echo count($month_events); and make sure it is the right # of events being returned by the selector $events->find("event_month=$month"); also maybe echo all the other variables to make sure nothing is going wrong somewhere, check the debug also?
-
This works: https://gist.github.com/outflux3/7608974 let me know if it works for you!
-
@alejandro wow - i need something like this TODAY - i was taking apart and recoding the Modx inventory http://modx.com/extras/package/foxycartinventory - could you post the whole script?
-
wow - thanks diogo i didn't know you could do that, i.e. set a new property for the page array... so this would be an altered version based on that.. <?php // get all of the events $events = $page->events; $years = array(); // find the array of years for all events foreach ($events as $event) { $years[]= date("Y", $event->getUnformatted("event_start_date")); // change the format of the year in memory for later comparison $event->event_year = date("Y", $event->getUnformatted("event_start_date")); } $years = array_unique($years); asort($years); foreach($years as $key => $year) { // find the array of events this year $year_events = $events->find("event_year=$year"); $months = array(); // loop through the events for this year and add the months to the array foreach ($year_events as $year_event) { $months[]= date("m", $year_event->getUnformatted("event_start_date")); $event->event_month = date("m", $event->getUnformatted("event_start_date")); } $months = array_unique($months); asort($months); foreach($months as $key => $month) { $month_events = $events->find("event_month=$month"); foreach($month_events as $e) { // output the table here } // end foreach events for this month } // end foreach months } // end foreach years ?>
-
hi joss - sorry - i think one reason why this isn't going to work yet is because we reset the variable in memory for $event->event_start_date so it probably has to be unset after each of the foreach statements that obtain the arrays of years and months...
-
this is my ghetto way of doing it, but wrote this in browser so more to give some ideas, i think there are still some issues with doing it this way... <?php // get all of the events $events = $page->events; $years = array(); // find the array of years for all events foreach ($events as $event) { $years[]= date("Y", $event->getUnformatted("event_start_date")); // change the format of the year in memory for later comparison $event->event_start_date = date("Y", $event->getUnformatted("event_start_date")); } $years = array_unique($years); asort($years); foreach($years as $key => $year) { // find the array of events this year $year_events = $events->find("event_start_date=$year"); $months = array(); // loop through the events for this year and add the months to the array foreach ($year_events as $year_event) { $months[]= date("m", $event->getUnformatted("event_start_date")); $event->event_start_date = date("m", $event->getUnformatted("event_start_date")); } $months = array_unique($months); asort($months); foreach($months as $key => $month) { $month_events = $events->find("event_start_date=$month"); foreach($month_events as $e) { // output the table here } // end foreach events for this month } // end foreach months } // end foreach years ?>
-
yeah, @WillyC right.. @kixe - can you put back the download link - i want to give it a try..
-
Hi Rjay- here is my example, this one uses dates in certain conditions and also page ids... https://gist.github.com/outflux3/7568222 this module works on the current dev, not sure if it works on the stable though should also mention that this is entirely based on the initial buildUrl module that pete posted on the link a few posts up
- 14 replies
-
- 1
-
-
@renobird - thanks again, i'll be back working on styling in a few days and will try the suggestion of setting body to open sans.. @alanfluff - thanks for checking it out... more to come in terms of 'case study' - doing some interesting things with url manipulation, c/o ryan's cms critic case study (in this case i have all of the classes bucketed under a 'class database' but output url is changed by hook)... still more versions to come in January & beyond, possible foxycart integration for payments, speed tweaks etc..
-
if you want to add the page id to the url, you can also add a hook, and do something similar to this: http://processwire.com/talk/topic/1648-ok-to-change-page-name-path-after-save/?p=15232 then you can setup how to save the url, so for example you could append the date, or the id to the end of the url, or anything you want... just did something like this on a recent site and ended up extending this buildUrl module a lot and having it set the page name and title based on the input of 7 fields on the template... if you need examples i can post a gist later
- 14 replies
-
@renobird - thanks, just fixed that faculty page, according to your advice...definitely looks better.. though it will inevitably be off on tablet because the names flow onto 2 lines - should still work because it's using isotope, expecting the possibility of different heights.. as far as typography, you're right, i'm just not sure where to fix it - do you mean the paragraph styling being Arial and some of the headers being Open Sans? I didn't do the base design on this, but i've been adding a lot to the original design as the project developed; i agree that the typography is wonky in places.. @kongondo - thanks for looking - yes, there are some little bits and pieces here and there that are wonky, will try to fix them but by bit! thanks everyone else for checking it out!
-
New site launched today: http://www.katonahartcenter.com/ Thanks to everyone in the forum who answered my posts over the last 8 weeks of developing this site, including adrian, teppo & ryan. modules so far that were essential: After Save Actions Color Picker Admin Custom Pages DataTable Redirects Template Decorator Form Save Reminder Hanna Code Hanna Code Helper Twitter Feed Version Control for Text Fields Form Builder ProCache Forum Threads that helped: http://processwire.com/talk/topic/4849-search-rar-and-tar-result-in-404/ http://processwire.com/talk/topic/4866-time-field/ http://processwire.com/talk/topic/3745-hanna-code/ http://processwire.com/talk/topic/4816-set-field-value-globally-if-null/ http://processwire.com/talk/topic/4602-flexible-downloads-using-pages/ http://processwire.com/talk/topic/1648-ok-to-change-page-name-path-after-save/ http://processwire.com/talk/topic/3987-cmscritic-development-case-study/?p=36867 http://processwire.com/talk/topic/3812-htaccess/?p=37295 using custom admin pages:
-
@kongondo thank you - i did just go ahead and use my normal way of managing menus which is by setting up a menu page tree and then coding the output manually; Welcome Back!