Jump to content

sasori

Members
  • Posts

    332
  • Joined

  • Last visited

Everything posted by sasori

  1. I have these three lines of strings ,that appears at the "Front-end" Listed via Carousell - http://carousell.co, Listed via Carousell - http://thecarousell.com Listed via Carousell - http://thecarousell.com/iphone The scenario is like this, I have a list of items, each of them has a description, and those strings appear in the description randomnly based from some criteria. the objective is, to hide these strings, but due to some highligting functionality, like, when someone search the string "Carousell" at the search box, the word "Carousell" appears to be bold , So when I check it in source code through firebug, the strings appears like these Listed via <em>Carousell</em> - http://carousell.co Listed via <em>Carousell</em> - http://thecarousell.com Listed via <em>Carousell</em> - http://thecarousell.com/iphone my first solution was to use str_replace() func, so I ended up like this $strfilth = array( 'Listed via <em>Carousell</em> - http://carousell.co', 'Listed via <em>Carousell</em> - http://thecarousell.com', 'Listed via <em>Carousell</em> - http://thecarousell.com/iphone', '<em>Carousell</em> - http://carousell.co', 'Listed via <em>Carousell</em> -', 'Listed via', '- http://carousell.co', 'Carousell', ); $filteredString = str_replace($strfilth,"",$dirtyString); That code above didn't helped at all So, I thought of using regex for these, but the problem is , how to cater for those two different scenarios ? , can someone help for the reg-ex pattern for those ? Thanks in advance
  2. I've solved this problem by using the DateTime::diff and I just threw an error message if the user selected a range that is more than a month worth of days
  3. i have 2 input forms, the "Date From" and "Date To" , both are using jquery's date picker My question is, how to limit the user to select only a range of one month using those two datepickers ? this is the snippet of the "Date From" date picker $this->widget('zii.widgets.jui.CJuiDatePicker', array( 'model' => $model, 'attribute' => 'STARTDATE', 'options' => array( 'dateFormat'=>'yy-mm-dd', 'showOn'=> 'both', 'buttonImage'=> Yii::app()->theme->baseUrl."/images/calendar.gif", 'buttonImageOnly' => 'true', 'dateFormat'=>'dd-mm-yy', 'changeMonth' => 'true', 'changeYear' => 'true', 'showButtonPanel' => 'true', 'constrainInput' => 'false', 'duration'=>'fast', 'showAnim' =>'slide', 'ampm' => 'true', 'onSelect' => 'js:function(selectedDate) {$( "#paymenttrans_TRANSDATETO" ).datepicker( "option", "minDate", selectedDate );}' ), 'flat'=>false, 'htmlOptions'=>array( 'readonly'=>'TRUE', 'size'=>'10', 'style'=>'margin-right: 5px;' ) ) ); the objective is like this, let's say the user selects date from January 1 to February 1, that's it,OR let's say the user selects January 5 to February 5.. if the user tries to select that has a range of more than 1 month , it should be prevented...how to do that? I have the idea of subtraction, but how? , what's the formula for detecting "if" the selected date range from the two datepicker is already exact 1 month ?
  4. same suggestion as other developers to whom I have asked from... but anyway...I have solved my issue on my own by just adding a simple if statement $container = array(); foreach($hugeObject as $k => $obj){ if(isset($obj[$obj->USERID])){ continue; if(count($container) < 24) $container[$obj->USERID] = $obj; }
  5. let's say i have a an object...it contains 100 objects/array..and then in it's sql query, I didn't use offset nor limit. my question now is, is there are way to manipulate the returned result using only PHP to display only like e.g 24 objects/array ? my objective is, I wanna paginate based on 24 result and not with 100 ..so how?
  6. awesome...can you help me paginate the result data? , based from the sample data result that I pasted? assuming there are 24 items per tabs, and each page per tab should display 6 per page
  7. the join thing has been accomplished and was lumped in the $hugeObject, this huge object contains 24 items already based from the actual complex query hence , I can display the items by : $buffer = array(); foreach($hugeobject as $obj){ if(isset($buffer[$obj->userid]))continue; $buffer[$obj->userid] = $obj; } foreach($buffer as $obj){ echo $obj->userid . " = " . $obj->itemid . " = " . $item->price . " = " . $item->itemtitle ."<br/>"; } sample data ( I don't have much unique dummy data) Tab1 201087 = 627756 = 432 = testadaftermigration1 201147 = 627697 = 432 = forhim mediaplayer1-user4 201386 = 627696 = 432 = forhim software1-user3nonreg 201146 = 627695 = 432 = forhim mobile1-user3 200485 = 627170 = 199 = Google Nexus 7 Tab2 201387 = 627840 = 58 = Beautiful Dresses 200484 = 627733 = 39.9 = Dorothy Lace Waisted Flare Dress-Estelle 201146 = 627728 = 123 = spa 201147 = 627727 = 123 = haircare 201087 = 627723 = 2323 = cosmetics2 200903 = 627712 = 345.99 = Chanel Ring 201386 = 627690 = 123 = forher haircare1-user3nonreg Tab3 201087 = 627758 = 123 = pp enabled1 201147 = 627700 = 123 = forkids bicycle1-user4 201386 = 627699 = 431 = forkids swimming1-user3 nonreg 201146 = 627698 = 323 = forkids book1-user2 201226 = 627636 = 23 = child case 200484 = 627082 = 1000 = IPhone 4S Tab4 201387 = 627840 = 58 = Beautiful Dresses 200484 = 627733 = 39.9 = Dorothy Lace Waisted Flare Dress-Estelle 201146 = 627725 = 123 = bags1 200903 = 627712 = 345.99 = Chanel Ring 201087 = 627703 = 856 = forhousehold petgrooming1-user1 201148 = 627702 = 464 = forhousehold petadoption1-user5 201386 = 627681 = 321 = forher womanshoes1-user1nonreg = 626769 = 2 = Elephant Ring ( but just like what you've said, you think something's gonna break.. i don't know what would that be )
  8. 1 ) Yes, but this is already accomplished because I got the UserID and can pass it to the href thing , and it will go to a different page already. 1-1 ) No. the display is viewed by public
  9. ok, these are the data that I needed to display - Item Title - item Price - Item image based from the map above, the left side represents the UserID while the right side represents the ItemID the items were not purchased at all.. these items were posted by registered and non-registered users and are need to be displayed in a sliding manner. there's also a possibility that the UserID is null if the item was posted by a guests .. ( guess I'll just remove that from the loop ) it goes like this. - there is a square at the front-end - inside that square ,there are four tabs - in each tab, the items should be displayed where by , the sql statement is limited to 24 ,where in, each item is owned by a unique user - under each tab. since the limit is 24 items per tab ,it should be displayed 6 at a time(paginated), in a sliding manner (powered by jquery slider ) (each tab has 24 items displayed based from the data fetched by sql )
  10. eliminating load of relationships? ...not really , all i want is to get the unique objects ...
  11. the data came from this foreach($hugeobject as $k => $obj){ echo $obj->userid . " = " . $obj->itemid."<br/>"; } it got solved by this $buffer = array(); foreach($hugeobject as $obj){ if(isset($buffer[$obj->userid]))continue; $buffer[$obj->userid] = $obj; } foreach($buffer as $obj){ echo $obj->userid . " = " . $obj->itemid . "<br/>"; }
  12. hi, i have a huge object... to make it easy to understand my question..i printed out the ID and the itemID associated to it 147099 = 594088 147099 = 594086 147099 = 594085 147099 = 594082 147099 = 594083 147099 = 594089 161676 = 594091 196351 = 593971 196351 = 593904 196387 = 593894 196382 = 593892 196382 = 593891 196382 = 593889 196382 = 593888 196351 = 593887 196351 = 593865 196351 = 593864 196722 = 593798 196351 = 593795 196351 = 593794 196351 = 593793 196351 = 593792 196722 = 593790 196351 = 593789 how to skip the duplicates in that ^ ? if am gonna use something like $array = array_map( 'unserialize', array_unique( array_map( 'serialize', $array ),SORT_NUMERIC ) ); it will print only this 147099 = 594088 my actual goal is to print "1 unique id to each 1 unique itemid" like e.g 147099 = 594088 161676 = 594091 196351 = 593971 196382 = 593892 196722 = 593798 so how ?
  13. Hi, I have a problem whereby I need to produce "only" one item per user e.g it's a portal that has many users and they can post alot of items, regardless whether it's a registered or non registered user. can someone give me a pseudo thing that may help solve this sql statement problem? or atleast an sql code snippet.. if I do this select userid, itemtitle, max(itemid) as ad from itemtable where status = 1 and expirydate > current_date and publishdate is not null and displaypublishdate is not null group by userid order by displaypublishdate desc; it throws an error in my sql developer ORA-00979: not a GROUP BY expression 00979. 00000 - "not a GROUP BY expression" *Cause: *Action: Error at Line: 33 Column: 15 it only produces results when i changed the "order by" into order by ad and removed the itemtitle among the selected columns but I need to order it by displayplublishdate or publishdate in descending order..and also I need to get the item title as well...because I need to display the item title in the front-end of the portal so how?
  14. Thanks for this cool array flipping tip...it actually worked, now my code is fixed
  15. I tried it again $next = ''; $prev = ''; $curr = ''; $ar = array(1624,2626,1628,1627); echo "<pre>",print_r($ar),"</pre>"; $curr = $ar[1]; foreach($ar as $a){ if($curr == $a){ $next = prev($ar); } else { $prev = next($ar); } } echo 'current = '. $curr."<br/>"; echo 'previous = '. $prev."<br/>"; echo 'next = ' . $next; and the result was Array ( [0] => 1624 [1] => 2626 [2] => 1628 [3] => 1627 ) 1current = 2626 previous = 1627 next = 2626
  16. No, they are not submit buttons ,they are just ordinary buttons.. whereby am planning to give it an href and point each button to the correct item page, any code snippets how to solve that array logic thing?
  17. the stuff is a huge object... to make my "asking for help" explanation simple, I only took the IDs and pushed them in an array..and it goes like this I have items that are being displayed as "comming soon", this means they are not ordered by ID but in the time slot stuff that was recoreded under each item. currently there are 4 comming soon items Array ( [0] => 1624 [1] => 1626 [2] => 1628 [3] => 1627 ) 1 they are displayed like that (horizontaly if you can imagine it with pictures ).. so my problem is,, let's say I am currently viewing the 3rd item's page, and at the browser bar , ofcourse the ID = > 1628 is displayed.and in each page, there is a "previous" and "next" button .....how am I going to get that previous and next ID whenver I am browsing in each pages ? , I tried using the next() and prev() built-in function of PHP but I failed and was bashing my head on table .. Thank you for the help in advance
  18. I tried this RewriteRule ^/buy-now/^(.*)$/order/(\d+)$ /buy-now/order/$1/$2 [R=301] still doesn't work at all
  19. e.g I have a urls like in this format, so here's one example http://www.mydomain.com/buy-now/this-is-the-product-one/order/1234 Considering an online shop contains alot of products with different product title and product ID right? how am I going to redirect "all URLs from that format", into "this new URL" via htaccess ? http://www.mydomain.com/buy-now/order/this-is-the-product-one/1234 the difference is, the word "order" got transferred beside the "buy-now" what to do?
  20. does that mean, there's no solution for this ? is there an advantage in showing that "via domain" thing ?
  21. this is what i want to see in the inbox..just the name of the sender and the subject while this is what i wanna see once you click the email row from the inbox list above see that from the header ? ... the "via craigslist.org" is appended at the full name of the sender, how to do that in phpmailer library ?
  22. hi, is there a way to show the e.g "via blahblah.com" in the recipients email header ? because if I do e.g "From: sender fullname <sender@email.com> via email.com" and send the mail..what am seeing is sender fullname<sender@email.com> via email.com subject when opening the inbox, it is appended in the sender's name what i want to see when the recipient opens the inbox is the Full Name subject then when he/she clicks that row of email from the inbox, he/she will see the Full Name <sender@email.com> via email.com at the email header..is that possible in the built-in php mail function or the phpmailer library ? coz i have browsed the manual, i can't see a solution for this
  23. hi, how to convert this excel spreadsheet into PHP ? B3 = principal = 1,934 B4 = interest flat rate = 15% fixed B5 = tenor in months = 60 fixed B10 = monthly = $46.01 the formula for cell B10 is PMT(B4/12,B5,B3) so how did the B10 became 46.01
×
×
  • 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.