Datafeedr Support Forums  

Go Back   Datafeedr Support Forums > Current Version (V3) Forum > Tips, Tricks & Tutorials
Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Important - The support forums are now in "read-only" mode as we transition to an alternative help desk solution. Feel free to contact us here with any of your questions or search the forums for an existing solution.
 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 21st, 2011, 05:21 PM
seovisions seovisions is offline
 
Join Date: Sep 2011
Posts: 12
Default Multiple category and sub-category insertion

Hello,

I have discovered, quite by accident, that adding categories and sub-categories makes use of a delimiter for multiple entries:

PHP Code:
category1/category2/category3 
This is partially useful in that it shows that datafeedr allows for multiple insertion of category taxonomies. However, it loses it's usefulness because of what this particular delimiter actually does:

PHP Code:
Main Category
Main Category 
category1
Main Category 
category1 category2
Main Category 
category1 category2 category3 
Which, essentially, nests each category followed by "/" into a sub-category of the one right before it. or:

PHP Code:
category1
-category2
--category3 
I've tried all the usual delimiter types to see if I could add several sub-categories under a main category in a single insertion. Such as

PHP Code:
/, |, \, :, `, ~, & 
of which only one has any result.

So my tip is the above, and my question is this:

Is there a delimiter in place to allow for multiple entries when adding categories and subcategories?
  #2  
Old November 21st, 2011, 06:55 PM
johnpo johnpo is offline
 
Join Date: May 2011
Posts: 48
Default

Yes the slash allows for one under one under and so on, unfortunately doesn't simply allow all one under so have to move them, but is still quicker than typing them all in.
  #3  
Old November 21st, 2011, 08:53 PM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Quote:
Originally Posted by seovisions View Post
Is there a delimiter in place to allow for multiple entries when adding categories and subcategories?
Not currently.
  #4  
Old November 22nd, 2011, 12:50 AM
seovisions seovisions is offline
 
Join Date: Sep 2011
Posts: 12
Default

perhaps you could add a delimiter. I am not entirely sure what you programmed everything in, nor how difficult it would be to add a delimiter.

Maybe a simple php explode on | would work along with a basic foreach with the SQL insert.

ie:
PHP Code:
$parent $_POST['parent'];
$add_category explode('|'$_POST['category_string']);

if(
count($add_category) > 0){

//multiple entries to add
foreach($add_category as $value){
try{
mysql_query("UPDATE table SET category = $value WHERE cat_parent = $parent );
}catch(Exception 
$e){
echo 'Exception caught: ',  
$e->getMessage(), "\n";
}

}

}else{

//it's a single entry
try{
mysql_query("
UPDATE table SET category $value WHERE cat_parent $parent );
}catch(
Exception $e){
echo 
'Exception caught: ',  $e->getMessage(), "\n";
}


You would, of course, fix it to fit the tables used, error checking, etc.
  #5  
Old November 22nd, 2011, 01:04 AM
seovisions seovisions is offline
 
Join Date: Sep 2011
Posts: 12
Default

preg_split() is another method to use if you want more control as well as preg_match_all().

Point is..lots of ways to do it. explode can be more memory intensive then the above two options.
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Multiple Category johnpo Questions 2 June 12th, 2011 08:05 PM
How do I make the Category Menu in the Atahualpa Theme reflect the datafeedr category cgarvey Questions 1 March 24th, 2011 01:45 PM
No Meta Data and Category Desciption on Default Category Page View cashnow Problems 5 February 4th, 2011 11:08 AM
How do I make a category view for my sidebar that only includes one main category? dcutri Questions 3 January 26th, 2011 01:40 PM


All times are GMT -5. The time now is 06:30 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.