Harmster Posted February 11, 2014 Share Posted February 11, 2014 Hey, I am, for my final project on school, making a picture database. The client wants to search in the database and I figured I implement a tag system. What is the best way to implement a tag system? A repeater field, a string field or an asm select ish input field? Thanks Link to comment Share on other sites More sharing options...
kongondo Posted February 11, 2014 Share Posted February 11, 2014 If I was going for something that would scale nicely, I'd go for the page reference field...Repeaters have their limits 1 Link to comment Share on other sites More sharing options...
Joss Posted February 11, 2014 Share Posted February 11, 2014 Yes, simply use a page field in conjunction with ASM and autocomplete (er, I think) and set up parent and child templates for the actual tags - so each tag is a page. If you set the page field to allow the creation of pages, and make sure your parent template can only use one template for children, then as you type it will autosearch for existing tags and if none exist then it will create one on return. Link to comment Share on other sites More sharing options...
Harmster Posted February 11, 2014 Author Share Posted February 11, 2014 Thanks for all your tips, for anyone also looking for a solution int he future ill describe what I did: I created a wrapper called tags and a new template tag. In the template I made 2 fields, title and page (A single page array) Then I created a searchbox and the following code: if($input->post->submit){ //form has been submitted; $tag = str_replace(',','|', $input->post->tag_search); $results = $pages->find("template=tag, tag=$tag"); } This is for searching on multiple tags.. This works like a charm and it is very, very flexible! Thanks everyone for your time & help! 3 Link to comment Share on other sites More sharing options...
kongondo Posted February 11, 2014 Share Posted February 11, 2014 Depending on the amount of tags involved, you might want to use a "limit" in your selector. Hey, this is a school project so might as well show them best practise... Link to comment Share on other sites More sharing options...
Harmster Posted February 12, 2014 Author Share Posted February 12, 2014 Depending on the amount of tags involved, you might want to use a "limit" in your selector. Hey, this is a school project so might as well show them best practise... Yeah, thats probably a good practise, though I just started to implement this, I think I want to implement infinite scrolling too Link to comment Share on other sites More sharing options...
ryan Posted February 16, 2014 Share Posted February 16, 2014 The blog profile is also a good demonstration of how to implement tags. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now