Logic Behind Blog Categories ?
   Hi,

 I'm developing a blog that will have categories. I want to be able to store blog posts in more than one category. My problem is i am not sure how to go about it.

 I have a table called posts:

 
```
CREATE TABLE `posts` (
  `post_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_uid` int(10) unsigned NOT NULL COMMENT 'user uid',
  `category_ids` varchar(255) NOT NULL COMMENT 'each category is seperated by a comma',
  `post_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `post_modified_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'date post was modified',
  `post_status` varchar(10) NOT NULL COMMENT 'publish = publish post | draft = save but dont publish ',
  `post_title` varchar(255) NOT NULL,
  `post_title_permalink` varchar(255) NOT NULL COMMENT 'post title for friendly urls (this title never changes to keep url valid if post_title changes)',
  `post_excerpt` text NOT NULL,
  `post_content` mediumtext NOT NULL,
  `comment_status` varchar(15) NOT NULL COMMENT 'open = comments allowed | closed = comment not allowed',
  PRIMARY KEY (`post_id`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

```
 I have another table called categories:

 
```
 CREATE TABLE IF NOT EXISTS `categories` (
 `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'auto generated id',
 `category_name` varchar(20) NOT NULL,
 `slug` varchar(20) CHARACTER SET utf8 NOT NULL COMMENT 'The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.',
 PRIMARY KEY (`id`),
 UNIQUE KEY `category_name` (`category_name`)
 ) ENGINE=InnoDB  DEFAULT CHARSET=utf16 AUTO_INCREMENT=3 ;

```
 Now i think my logic of the two tables above are fine (hopefully), but my problem is i don't know how to go about allowing a blog post to appear in more than one category.

 Trying to think of all possible sceneraios my questions are:

 1) What do i need to do to allow a blog to be posted in more than one category ? (i know what i need to do in regards to the html and displaying the categories from database, but the logic i am stuck on is i have a [b]category\_id[/b] column on the [b]posts[/b] table which will store the id of the category i am storing the blog post into which is fine if i only post a blog post in one category but to choose more than one category i am not sure how i would store that in the database as the category\_id in the posts table is to store one category (which is the category\_id from the category table), i don't know if i need another table perhaps, i am clueless how people generally deal with this sort of thing like categories ?

 2) another possible problem i may encounter in future, what if i delete a category, how should i go about dealing with blogs posts posted in a category that i want to delete ? ( i may not want to delete the blog post just the category, therefore any posts in that category is going to need to be moved somewhere else, how to people generally deal with the scenario when developing such a system ?

 Thanks for any help. I don't need to know the php code just the logic behind it all. I do have a users table etc but kept it simple as i could as the rest i have no problem with.

 Thanks for any help  

PhpLover
Instead of the field category\_ids, create a link table consisting of the post id and category id.
You want something similar to this :



```
using (var context = new BloggingContext())
{
    var blogs = context.Blogs.SqlQuery("SELECT * FROM dbo.Blogs").ToList();
}

```

You can find tutorial for that here :
<http://msdn.microsoft.com/en-us/data/jj592907.aspx> Whew. Lot of topics in that short post!

First, the <Art>/Article tag is a container/grouping tag that wraps around a bunch of content tags (like <P>, <H2>, <L>, <Table>) to create a logical area of the larger document.

<Art> tags are created for each story/article dragged into the Articles Panel. How you group your stories is up to you. Some examples:

* If it's a small document, like a fact sheet or brochure, then 1 <Art> in the PDF might be sufficient for the whole document.
* If it's a 10-chapter book, then each chapter could be a separate <Art>, and there would be 10 (or more) <Art> tags in the entire PDF.
* A magazine would have 1 <Art> tag for each feature story.

 

Quote: "*Any other accessibility tips would be greatly appreciated*"

 

Ha ha! That's like asking how to use Photoshop in a little post in this forum. Accessibility is an extremely broad, but specific, requirement and you really need formal training in how to do it with InDesign. Look for classes from:

* Chad Chelius at LinkedIn Learning
* CreativePro's InDesign Accessibility Summit <https://creativepro.com/indesign-accessibility-summit/>
* Bevi Chagnon at [www.PubCom.com/classes](http://www.PubCom.com/classes)

 



 Design + Accessibility | Author | Designer | Programmer | Trainer my guess would be that a config like this might work:

collections:

- name: 'site 1'

create: true

label: 'posts'

label\_singular: 'post'

folder: 'sites/content/posts/site-1'

.

.

.

- name: 'site 2'

create: true

label: 'posts'

label\_singular: 'post'

folde… You would be better to turn off lazy loading by default and instead specify when you want to load the extra data in the first place. EF is set up to allow Eager loading by using the .Include() function on your query, with lazy loading it can get messy if you start turning it on/off for various functions, you're better to just turn it off and manage what/when you want data loaded if you're feeling a need to turn it off.


See <https://msdn.microsoft.com/en-nz/data/jj574232.aspx> for specific examples and a breakdown of the different ways you can eager/lazy load data. The first example shows how you could pull through posts off a blog, which is similar to what you are wanting to acheive.



```
var topics = context.Topics 
                      .Include(t => t.Posts) 
                      .ToList(); 

``` giving a name to checkboxes means grouping them together to the same question

if you have 10 questions, and each has 5 checkboxes, and you don’t group them together, that would mean having 50 checkboxes lumped together - maybe you have also pretty similar values etc…

you give each checkboxes group… if you visit admin > customize > embedding you can change “maximum number of posts to embed” to a higher value. this is a terrific question and i am glad you asked it.  as i am only in the beginning stages of planning to implement this here (it has not been a requirement yet, but will be soon), i can only add some preliminary thoughts to yours:

microsoft should bold, underline, highlight, and add 50 exclamation points to that statement about keeping queues to a minimum.  the performance hit is staggering, if your system has a high number of concurrent users.  you probably won't notice it in your dev or test environments if there aren't many simultaneous testers, however.

so in the spirit of getting the most protection from the fewest number of queues, i am asking some of the following questions:
* is it sufficient to classify ticket data along the lines of "sensitive, private, privileged" or some other such division, so that i could only create queues based on the sensitivity level of information, and not have to split it further by department/team/function/etc.?  this is a business question that will vary for everyone, of course.
* if the above is possible, i can add a classification enum to the tickets and develop a procedure for which should be selected, and base the queue on its value.  if it is not, or if my ticket category or support team already tells me what i need to know, then this is not even necessary.
* if data sensitivity is not a viable way to divide queues, then do i have certain support groups that need a queue, and all others would not belong to a queue?

in any scenario i have described or implied, this means that (most) teams can see each others' tickets.  this is not a problem for me in this environment, but might be for others.  as long as i wrap a queue around the most sensitive tickets, i do not mind if the rest are out in the open.

again, i have not proven these thoughts in production yet, but hopefully it helps to some degree. hi,

unfortunately due to wordpress restrictions we couldn’t add a confirmation on plugin delete action if the user wants to keep existing tables and charts. previously we were just keeping those in db, but it caused problems when someone wanted to clean up the site and remove the plugin. we are sti… ok i got it,

'categories' => get\_the\_term\_list($post->id, 'portfolio\_categories'),

maybe that will be useful for somebody in the future. i've been meaning to write a blog post on this for a while, but haven't got round to it yet, so i'll give the condensed version here :slight\_smile:

to understand why the if let syntax is the way it is, we should first look at the let syntax. in most cases, you'll see it used for simple variable dec…