Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About MoFish

  • Rank
    Advanced Member

Profile Information

  • Gender
    Not Telling
  1. Hi All, I have mark-up which contains many {{edit:xxx}} tags this is inside a variable called $html I'm trying to find all these edit tags and displaying the name, but am not sure best how to achive it. For example my $html contains: {{edit:top}} {{edit:bottom}} {{edit:left}} {{edit:right}} I want to create a $results array with the following values: top bottom left right Many thanks, MoFish
  2. Hi requinix, Thanks for your reply. I may look at parsing the document for items in double braces instead, hopefully that makes things a little simpler. Cheers, MoFish <img src='{{source}}' label='{{label}}' help="{{help}}" />
  3. Hi, I am trying to use DOMdocument to find <edit> tags in my HTML. When I use an <edit> tag on it's own it works fine and finds all the information I require On the odd occasion, I am required to put my <edit> tags inside quotes (as per my second example commented out) which falls over. I'm assuming it does not like the quotes and is bombing out Can anyone shed some light on if this is possible? or will this simply not work with the DOMdocument due to it's structure? I understand its' not the norm. Many Thanks, MoFish <?php // works $html = "&l
  4. Hi, I am looking to alter this slightly and am not sure how best to go around it. What I am now trying to do is: Set a start date e.g first day of January (2017-01-01) Set a end date e.g last day of December (2017-12-31) Find the number of weeks between the two date ranges (2017-01-01, 2017-12-31) which returns 52 weeks. And the tricky bit - for each of these 52 weeks - find the weeks startdate (Monday this week) and enddate (Friday this week). I have got the first three steps working using the function below, but am a little unsure on how best to find out the start date and end dates of
  5. Hi Barand, Thats exactly what I needed. Thank you very much. MoFish
  6. Thanks, I think I have got the week calculation bit working after some messing around. I am trying to change my array slightly to 'group' the results into week numbers but am hitting some road blocks. I seem to get one week in the correct one, but not all of them I currently have: Array ( [0] => stdClass Object ( [SALE_ID] => 1 [SALE_DATE] => 2017-01-01 [SALE_WEEK] => 1 ) [1] => stdClass Object ( [SALE_ID] => 1 [SALE_DATE] => 2017-02-15 [SALE_WEEK] => 4
  7. Thanks Barand, I've not been able to use the function successfully due to the information I'm passing in being incorrect. I'm not sure how best to format this. DB value: // 2017-02-17 00:00:00 Argument 1 passed to sale_model::week_number() must be an instance of DateTime
  8. Hi Requinix, Thanks for taking the time to respond. I have tried your example - but am getting the following when trying it with my code from value from the DB. Argument 1 passed to sale_model::week_number() must be an instance of DateTime The value is 2017-02-17 00:00:00 from the database - should this be amended before going into the function? Thanks, MoFish // return $return = $this->query("select * from SALE;", true); // foreach foreach ($return as $item){ echo $item->SALE_DATE; //2017-02-17 00:00:00 $week = $this->week_number($item->SALE_D
  9. Hi, I'm trying to associate a week number for a date I receive from my database. The week number is calculated between the last Friday of the previous month and the last Friday of the current month for that particular date. I would expect the week number to be 1,2,3 or in some cases maybe a 4 week month. I tried to use DatePeroid without much success, I've never used it before but feel im using it incorrectly as something is not quite right. Could anyone help? Regards, MoFish // try to find the week number foreach(new DatePeriod($rstart, new DateInterval('P1D'), $rend
  10. Hi Barand, Thanks for this. This was not producing the results as I was expecting - however I have modified the query and this seems to be working now. SELECT * FROM TABLE WHERE `DDATE` BETWEEN (UTC_DATE() - INTERVAL 2 DAY) AND UTC_DATE() Thanks everyone for taking the time to respond. MoFish
  11. Hi requinex, Yes, I want all of the results. I have tried your query - however this is not working quite as expected. Maybe this will help explain what I'm trying to do: if TODAY is in the 3 DAY RANGE of DDATE value - then display results
  12. Jacques1 & requinex - Sorry about this. I'm still not getting the results I require. The following is still not returning the correct data - even without the -. I have attempted so many queries myself and none appear to be correct. SELECT * FROM TABLE WHERE DATE(`DDATE`) = DATE_ADD(UTC_DATE(), INTERVAL 3 DAY)
  13. Hi Requinex, Yes, I looked at your query - however noticed you had put a limit on the end of the query - which made me think we were talking about differing things. I could potentially expect more than one result as per my example results above. I have tried multiple times to do the 'middle bit' but am struggling a little. I thought my query above was close.
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.