 i guess it is time to come back from my little hiatus to actually write a blog post i recently moved so i have been busy with getting settled and working on freelance projects as well if you follow me on twitter you may have noticed that i have recently become obsessed with expressionengine i completed a project at work using it and i realized that i could have done something much more efficiently view demo i had to create an online newsletter that had issues that were made up of multiple articles i ended up creating two separate weblogs one for each issue and one for individual articles in the issues weblog there was a playa custom field which could be used to pick the individual articles to be published in that issue but another one of brandon kellys fabulous extensions fieldframe seems to be a much better choice for creating this functionality so download install enable the fieldframe extension and lets be on our way creating the custom field group first lets create a field group named newsletter now we just need to create one custom field with the field name of newsletter articles select ff matrix as the field type we want to have two cells in the ff matrix articles title articles body the cell types should be text and textarea respectively then adjust the sizes as you see fit creating the weblog now that we have the custom field group setup we need to create a new weblog called newsletter and make sure to assign our newsletter field group to it now that the newsletter weblog is created we can start adding newsletters first fill in the main title field and then add in one or more articles now lets get onto coding the output template creating the template lets start by creating a new template group called newsletter we have two different pages that we want to create the page listing all of the newsletter entries and the individual newsletter entry displaying all of the articles but we can do this with only one template so open up the index template in the newsletter template group and we will start by setting up the structure of the template assign variable weblog= newsletter embed= newsletter header title= if segment 2 display individual newsletter entry title here if else newsletters if if segment 2 display full individual newsletter entry with 1 or more articles if else display list of newsletters entered if embed= newsletter footer we start by creating a variable to store the name of our weblog then i created a simple header and footer to store some of the html that frames the page i am passing in the title value in an embed variable to the header and displaying that in the browser title if the segment 2 value is not null we know that we are on an individual newsletter page so we will display that title if the segment 2 value is null then we are on the main newsletter listing page so we just display newsletters we are using the same conditional again for the content on the page we either show the individual newsletter entry with the articles or we show the list of newsletter entered so lets build out the code a little more first lets finish displaying the title embed= newsletter header title= if segment 2 exp weblog entries weblog= weblog limit= 1 disable= categories category fields custom fields member data pagination trackbacks title entry date format= %f %j %y exp weblog entries if else newsletters if pretty simple stuff here just displaying the title and entry date of the newsletter entry next lets tackle displaying the single newsletter entry view if segment 2 exp weblog entries weblog= weblog limit= 1 disable= categories category fields custom fields member data pagination trackbacks h1 title entry date format= %f %j %y h1 newsletter articles div class= entry h2 articles title h2 articles body div newsletter articles exp weblog entries pa href= path= newsletter laquo back to newsletters a p the beginning should look pretty normal just using the standard exp weblog entries tag to pull in the individual entry we first display the title and entry date then the next part is where we are taking advantage of the fieldframe matrix we are basically just looping through all of the newsletter articles and displaying them in divs finally lets finish up by displaying the list of newsletter entries if else exp weblog entries weblog= weblog disable= categories category fields custom fields member data pagination trackbacks if count == 1 ul if lia href= url title path= newsletter title entry date format= %f %j %y a li if count == total results ul if exp weblog entries if simple stuff again just looping through all newsletter entries and displaying them in a list the two conditional statements are so you dont end up with any empty unordered lists when there are no entries view demo i wish i would have realized this would have been a more efficient way to build a newsletter in ee for the project but this is why always learning is so important 