The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
select a category by name instead of id
currently I am using the following code to show the news for an entry in vbdynamics. I currently have to enter the category id into a custom field on the entry to get it to work. The title of the entry will be the exact same as the title of the category and I am looking to knock out a stop. Here is my code. I will have to change $entry['field97'] to $entry['title'] The area betweeen the comment is where I need to make the changes, I think.
PHP Code:
|
#2
|
|||
|
|||
If I understand what you want to do, I think you would want to change the "WHERE" line to:
Code:
WHERE ".TABLE_PREFIX."cms_category.category IN ('$category1') and since you really should use escape_string on a string in case it contains any special characters, change the line that sets $category 1 to Code:
$category1 = vB::$db->escape_string($entry['title']); One other thing, it looks like the original code is written to allow field97 to be a comma separated list of category ids, and with the modified code you can only have one title. |
Благодарность от: | ||
AndrewSimm |
#3
|
|||
|
|||
I get
Warning: mysqli_query() [function.mysqli-query]: (42000/1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Yearby) AND (cms_node.setpublish != 0) ORDER BY cms_node.publishda' at line 28 in [path]/includes/class_core.php on line 1391 The title and category are 2 works with a space and I think that is causing the issue. Thoughts? --------------- Added [DATE]1370565728[/DATE] at [TIME]1370565728[/TIME] --------------- oops nevermind it works! You are the man! |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|