Recent Articles

Simple PHP access control

Access control can be a complicated process.  Taking a “simple, but not simpler” approach allows extensibility in this basic task of web application development.

Read on
 

EE’s {weblog_short_name} and CSS

Sometimes CSS can be used in very creative ways, especially when there’s dynamic content.

Read on
 

DOM Trick: de-thumb an image URL

When ExpressionEngine auto-creates a thumbnail image, it gives the option for creating the markup to display the full size image in a new, pop-up window or in a blank window.  If you’re like me, those options aren’t optimal.  So I put together a handy 4-line Javascript DOM trick to give me other choices.

Read on
 

Resource: Findable Websites

There’s many books and resources available on designing client- and server-side web sites, but few which focus on the practical methods of creating web sites that users can find.  This is one worth mentioning.

Read on
 

Converting URL to clickable link

Using a regex routine, we can find instances of URLs in a block of text and wrap them in <a> elements.

Read on
 

EE’s {weblog_short_name} and CSS

Sometimes CSS can be used in very creative ways, especially when there’s dynamic content.

In a current project, I needed to display the owner’s blog entries intersperced in the same listing as her craft projects.  The craft project container contains a custom field group, so I couldn’t simply loop through both containers.

CSS was the solution.

Using EE’s {weblog_short_name} as trigger, I created a different CSS rule for each container.  Next, I added the necessary page elements and EE tags to display the two continers.  I then wrapped the containers in their own <div> element to bring in the appropriate CSS rules.  Finally, I used the CSS rule “display:none;“ to control whether or not to display the container based upon the value of {weblog_short_name}.

Below is a rough approximation of what was needed:

Markup

<div class="{weblog_short_name}">

  <
div class="weblog">
    
// elements and EE tags
  
</div>

  <
div class="projects">
    
// elements and EE tags
  
</div>

</
div

CSS

/* The names of the two containers are "main" and "blog" */

   
.blog .projects{
      display
:none;
  
}

   
.main .weblog {
      display
:none;
  

This works well.  I would rather see EE have a built in switch or a conditional statement which checks the name of the container, but in lieu of that, this methods works just fine.

05/27 at 01:56 PM

Comments

  No one's commented yet. Add yours!

Add Comment

Name:

Email:

Location:

URL:

Remember my personal information

Notify me of follow-up comments?

Submit the word you see below:


© 2002-2008 | carvingCode ™ | carving unique nooks in the web ™ | simple, but not simpler ™