hit wordpress category according to string

altweltgeier

Client
Регистрация
26.10.2011
Сообщения
14
Благодарностей
1
Баллы
0
Hi!
My first big template is done, a wordpress poster with login, post, pull/safe content and logs.
I figured everything out, its very intuitive!

Except of one thing, i think i need a complex regular expression for that:
I have the following code from the site:
Код:
<div id="categories-all" class="tabs-panel">
	<ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
<li id='category-1' class="popular-category"><label class="selectit"><input value="1" type="checkbox" name="post_category[]" id="in-category-1" checked="checked"/> Allgemein</label></li>
<li id='category-26'><label class="selectit"><input value="26" type="checkbox" name="post_category[]" id="in-category-26"/> Kredit</label></li>
</ul>
</li>
<li id='category-27'><label class="selectit"><input value="27" type="checkbox" name="post_category[]" id="in-category-27"/> Handy</label></li>
<li id='category-11' class="popular-category"><label class="selectit"><input value="11" type="checkbox" name="post_category[]" id="in-category-11"/> Wirtschaft</label></li>
<li id='category-12'><label class="selectit"><input value="12" type="checkbox" name="post_category[]" id="in-category-12"/> Wissenschaft</label></li>
	</ul>
</div>
Now i want to post one text with the topic "handy" and another with "Wissenschaft".

I have prepared possible names for this topics in connected files.

Handy:
Handy;Mobil;Mobile;Mobiltelefon

Wissenschaft:
Wissenschaft;Bildung


What is the correct way to
- get the id of the <input> element which is one of the prepared possible categories and check this item by id
- to check the <input> which is one one of the prepared possible categories

Of course i would prefer the second one, did i miss a thing where you can select an input field by the text?

Thanks guy´s!
 

altweltgeier

Client
Регистрация
26.10.2011
Сообщения
14
Благодарностей
1
Баллы
0
just figured it out by myself... maybe not the best way to do it but it works:

get string from file, checks with regular expression for presence in source, loops until one is found, second regular expression to find the id of this element in the line where presence was found and then the actual event for choosing the category by id.

by the way: i did not get it working with value, only with id. I would love to check for both things in case one changes, any ideas why it doesnt work? anyways... its working and i am almost shocked how easy it was! Great tool!
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)