Jump to content

mendoz

Members
  • Posts

    118
  • Joined

  • Last visited

    Never

Contact Methods

  • MSN
    dror_wolmer@hotmail.com

Profile Information

  • Gender
    Not Telling

mendoz's Achievements

Member

Member (2/5)

0

Reputation

  1. I've been messing with Zend framework and some new stuff and this my new approach. Each site will have it’s data on a locally stored XML file. The master site can trigger an update on the client site, which would make the client to get an update XML file and cache it. This way The data is stored only on one database.
  2. Sorry, my bad. I'm talking about getting the value from the $str variable, not the array.
  3. <?php $str = "[en]news for the site[/en][es]noticias para sitio[/es]"; $arr = preg_split("(\\[.*?\\])", $str,null, PREG_SPLIT_NO_EMPTY); $languages = array('en','es'); $post = array_combine($languages,$arr); ?> gives: Array ( [en] => news for the site [es] => noticias para sitio ) If I want only whats snide the [en][/en], how can I get it?
  4. Works, but then you'd lose what's inside the square brackets.
  5. Freaks! If I have this text [en]news for the site[/en][es]noticias para sitio[/es] how can I filter it into something like this: Array ( [en] => news for the site [es] => noticias para sitio ) What would be the most efficient way? Thanks, Mendoz
  6. S'up freaks I will have 70 sites fetching data from one "master" website. Each site will need different portions of the data. The client wants to manage all the sites from one main control panel. The data is a list of items, each record has data like (name,date,etc...) Each item has one or some websites that will use it. Each website will get it's corresponding items from the "master" website. Is the right way of doing this is via XML? Each website would request the feed like feed.php?site_id=10, Then it would get it's specific data. Now, What are the best practices for doing this? Caching the feeds and checking if there was an update? Learning what the hell is XML-RPC? Something I'm missing? Thanks, dror
  7. Got it, My problem was that the code for the banner was treated like XML, not a string. Changing '>' to '&#60;' and '<' to '&#62;' solved the problem.
  8. Hey freaks, I'm trying to parse an XML file in PHP, but I need to do thing simpler. This is my code: <?php $file = "http://godojo.org/new/file.xml"; $data = file_get_contents($file); $xml = new SimpleXMLElement($data); $banners = array(); foreach ($xml->children() as $banner) { // get the banner's ID $banner_id = intval($banner['id']); // Loop through all the banners foreach ($banner as $content) { // start building the link $link = "<a "; // get the attributes for the anchor foreach ($content->a->attributes() as $name=>$val) $link .= $name .'="'.$val.'" '; $link .= "><img "; // get the attributes for the img foreach ($content->a->img->attributes() as $name=>$val) $link .= $name .'="'.$val.'" '; $link .= "/></a>"; } $banners[$banner_id] = $link; } print_r($banners); ?> which outputs: Array ( [1] => <a target="_blank" href="http://www.rubyfortune.com/index.asp?s=wgs16875&a=wgsaffad18294" ><img border="0" alt="gambling" src="http://www.wagershare.com/affiliate_media/Banners/b3627.gif" /></a> [2] => <a target="_blank" href="site2.com" ><img src="2.jpg" /></a> [3] => <a target="_blank" href="site3.com" ><img src="3.jpg" /></a> ) This works, but I don't want to parse every attribute, I just to get everything that is inside the <content> element. For example: <banner id="3"> <content> <a target="_blank" href="site3.com"><img src="3.jpg"/></a> </content> </banner> I just want to get: <a target="_blank" href="site3.com"><img src="3.jpg"/></a> Without parsing each and every one of the attributes, or maybe run out of luck if there is no 'img' element inside the anchor. So how do I "bulk" get all that's inside the <content> element? thanks, mendoz
  9. try changing path/to/image.jpg to /path/to/image.jpg And see what happens with the image's URL.
  10. Thanks my friend, this worked: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !(.*)/$ RewriteRule ^(.*)$ $1/ [R=301,L]
  11. Konichiwa freaks Here is my .htaccess <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /guitar/ RewriteRule ^catalog/ /guitar/dir/catalog.php [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d #wordpress RewriteRule . /guitar/index.php [L] The thing is: I want mysite.com/catalog/category to become mysite.com/catalog/category/ This shouldn't be much of an issue, right? Thanks!
  12. Hey freaks. I'm working on a products catalog application. Every product has a parent category. The categories are organized nicely in a tree, Only the leaves have products associated with them. I hope you understood because now comes the questions: 1. What to do with the products associated with a leaf after it has been deleted? Should I delete the products as well? Put them in a trash bin? 2. What happens with the children of a node after it's deletion? Do they become the children of the node's parent? 3. Why do I like this site? Because the people are nice and answer fast and accurate !
  13. Yeah, but I want different templates . Maybe all categories will show ('name','year','weight','height'), Except for two categories which will show ('name','year','color','temperature'); So I would need two templates. What I did so far: templates_table: template_id template_name templates_cell_table: cell_id template_id cell_name products categories data_templates templates_cells id id id id parent_id parent_id name template_id name name text [/td] [td]template_id Now it is easy to select a template and to get it's cells. But what about the data for each product?
  14. Thanks for your comment smartin. You got my request wrong, I already have an idea of how the front-end should be like. I'm just asking for an idea on what tables do I have to create to store this dynamic data.
  15. Try this: <?php // Get the results from the database $mlistcontacts = mysql_query('SELECT email FROM emaillist WHERE emailID>0'); // You want an associative array, not a numeric, so we'll use mysql_fetch_assoc while($mlistcontacts = mysql_fetch_assoc ($mlistcontacts)) { // You forgot the single quotes around email $contacts[$i] = $mlistcontacts['email']; $i++; } echo implode(",", $contacts); ?>
×
×
  • 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.