Git Product home page Git Product logo

surgeree's Introduction

SurgerEE

A collection of simple tags for expressionengine that make template surgery easier.

Installation

Simple Installation

Simply copy the pi.surgeree.php file into a directory called surgeree inside the third_party folder of your ExpressionEngine installation.

Fancy Installation (for git users)

Make this repo into a submodule for your project's private ExpressionEngine git repo.

git submodule add git://github.com/dsurgeons/SurgerEE.git system/expressionengine/third_party/surgeree

For added flexiblity, fork this repo and make the submodule to your fork instead. Don't forget to submit pull requests after you've added stuff :).

Documentation

Please see the wiki for in depth documentation.

Changelog

Version 1.5.7

  • Add segments_but_last tag to get the current uri minus the last segment.

Version 1.5.6

  • Fix issue with ensure_http. [Carl Crawley]

Version 1.5.5

  • Version number was not bumped in previous release.

Version 1.5.4

  • Modified ensure_http to notice https:// hyperlinks. [Carl Crawley]

Version 1.5.3

  • Add two new methods for accessing get and post variables from within templates.

Version 1.5.2

  • Add method for ensuring http is in a url.

Version 1.5.1

  • More comprehensive documentation added and moved to the github wiki.
  • Fix a bug with loop method reporting total incorrectly.

Version 1.5

  • round_divide replaces ceil_divide with a more general implementation, allowing you to specify which way to round.
  • Added format_number method.
  • Added loop_fill method.
  • Added url helper methods all_segments, total_segments and current_url.

Version 1.4.2

  • Move repo to organization.

Version 1.4.1

  • Add MPL license to make this code usable by others.

Version 1.4.0

  • Rename plugin to SurgerEE.
  • Rework readme into Markdown.

Version 1.3.0

  • Add url_title2entry_id method.

Version 1.2.0

  • Numerous bug fixes.

Version <=1.1.0

  • Initial plugin development

surgeree's People

Contributors

epocsquadron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

surgeree's Issues

Active record

Since we're discussing standards, should be good to use just CodeIgniter Active Record, instead of plain SQL. Active_record is safer than plain SQL and works on others databases than MySQL.

If you agree, I can convert the current functions.

It's good to help.

Segment helpers

Is your plan to add some segment helpers available on CodeIgniter? If you want, I can add them.

Thanks!

Modulo bug?

Hi Daniel, wonder if you might check this please. Your example {exp:surgeree:modulo numerator="4" denominator="3"} outputs 0 and not 1.

Best wishes
Lee

Selective parsing of modulo in (sub)template

Here's a funny one for you.

This useage, as per your example -

{exp:channel:entries dynamic="no"}
    {if '{exp:surgeree:modulo numerator="{count}" denominator="2"}' == 1}<div class="section">{/if}
<h3>{title}</h3>
    {if '{exp:surgeree:modulo numerator="{count}" denominator="2"}' == 0}</div>{/if} 
{/exp:channel:entries}

(a massively simplified version of a subtemplate I'm using)

produces:

    <h3>Title 1</h3>
                    </div>
    <h3>Title 2</h3>
                    </div>
    <h3>Title 3</h3>
                    </div>
    <h3>Title 4</h3>
                    </div>
    <h3>Title 5</h3>
                    </div>
etc...
  • indicating that exp:surgeree:modulo either isn't working or isn't getting the correct value for {count}, as it's always evaluating to 0.

Probably the latter since

{exp:channel:entries dynamic="no"}{count}
    {if '{exp:surgeree:modulo numerator="{count}" denominator="2"}' == 1}<div class="section">{/if}
<h3>{title}</h3>
    {if '{exp:surgeree:modulo numerator="{count}" denominator="2"}' == 0}</div>{/if} 
{/exp:channel:entries}

will fix the problem.

Any idea why?

I've one hypothesis: EE doesn't spot the use of {count} in the surgeree tag, so doesn't bother running the code to replace {count} with the value. That's a wild stab in the dark. It's the sort of foible that we learn to love and/or lose hair over when using EE.

Can modulo be made to work here? Simple workaround to put {count} in an HTML comment, of course.

No content output when i leave ee var {count}

Hi there,

i don't know if it's a bug, but if i don't use the var {count} to switch between odd and even entries, i get no results.

{exp:channel:entries channel="projects" status="open" dynamic="off"}

{if '{exp:surgeree:modulo numerator="{count}" denominator="2"}' != 0}

Simple output

{/if}
{/exp:channel:entries}

Number Formats

Is it possible to add support for number formats? I'm thinking support for some of the standards like: adding comma for thousands, adding dollar sign for money, rounding decimal spaces to two. I was using 'Number Format' but it's not really being supported under EE2, plus the less plugin the better, and SurgerEE has been great for other common uses.

Regex code bug

I love your module, thanks for it. I wanted to use your regex tag and it kept not working and I found that the problem in EE 2.6 was the following line I was using to write my code:

{if `{exp:surgeree:match string="foo" regex="^[f]"}' == 'y'}

It should be

{if '{exp:surgeree:match string="foo" regex="^[f]"}' == 'y'}

Thanks again. And by the way I got this snippet from your string wiki page.

Entry Counter

It would be nice to be able to count entries with category and channel options. This is especially useful when using Gumby Toggles & Switches and the toggle itself is separated form the content it is toggling.

For example:

{if '{exp:surgeree:count channel="news" category="4"}' > 5}
{!-- do this --}
{/if}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.