ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Allow EE Code redirects to the GitHub page

January 30, 2012 4:36pm

Subscribe [2]
  • #1 / Jan 30, 2012 4:36pm

    Ataul Munim

    17 posts

    hi,

    I installed the Allow EE Code plugin, saving the “pi.allow_eecode.php” file to “mysite/mysystem/expressionengine/third_party/allow_eecode/pi.allow_eecode.php”.

    I added the tag to my template:

    <div class="entry-body">
    {exp:allow_eecode embed="y"}
    {journal_entry_body}
    {/exp:allow_eecode}
    </div>

    And in my post entry:

    <figure class="float-left">
    {entry_image_01}
    <figcaption>Marceline</figcaption>
    </figure>

    where {entry_image_01} is the short-name assigned to an image file that has been uploaded, and is associated with the current post entry.

    Text formatting on that post is set to “None” (though I’ve tried it with “Allow EE Code”), and when I attempt to see the page, it redirects to the GitHub page of the plugin. Attempting also to go to the Plugins area of the control panel redirects to that GitHub page.

    http://www.ataulmunim.co.uk/eyup

    Any ideas appreciated. Thanks 😊

     

  • #2 / Jan 31, 2012 6:07am

    Ataul Munim

    17 posts

    Freelancer v2.4.0- Build: date 20120123

    I will try the solution mentioned here when I get home:
    http://ellislab.com/forums/viewthread/139040/

    Deleting, redownloading the plugin and adding it to the third-party folder didn’t work. Attached is a screenshot of “Control Panel > AddOns > Plugins” page, where I have to scroll down, past the GitHub page to see the plugins page.

    I’ve commented out the tags in my template file for now, as the error message revealed my system folder path - I assume it’s something I’ve done wrong prior to the stage of using the plugin in my templates, otherwise it wouldn’t affect my Plugins page in such a fashion. For reference, the error message at the bottom of the rendered template page (after scrolling past the GitHub page) was:
    “Fatal error: Class ‘Allow_eecode’ not found in /home/ataulmun/public_html/eyup/MYSYSTEMFOLDER/expressionengine/libraries/Template.php on line 1232”

    To reiterate:
    - I downloaded the php file (https://github.com/EllisLab/Allow-Eecode/tree/master/allow_eecode&#41;
    - I put it in a folder called “allow_eecode” on my local disk.
    - I copied it via FTP to the “../mySystem/expressionengine/third_party/” directory such that the complete path looks like: “/public_html/myEESubDir/mySystemFolder/expressionengine/third_party/allow_eecode/pi.allow_eecode.php”

    I also have applied the .htaccess rewrite to remove the “index.php” (where in my instance I had to use “/index.php” as my EE installation isn’t on the root of my www directory.

  • #3 / Jan 31, 2012 7:29am

    mark186282

    290 posts

    I don’t have that particular plugin, but it looks like something is being printed to the headers at line 11 of that plugin - which is crashing everything else when I tried to finish off the page and do other things to the headers.

    Looking at this page:

    https://github.com/EllisLab/Allow-Eecode/blob/master/allow_eecode/pi.allow_eecode.php

    there’s a big comment at the top of the page that would be anywhere near line 11

    ...

    Are you double-positive the section of that file on your server is exactly like the source code on the page I linked to above?

    a few things to check:

    * the opening PHP tag is there?
    * there’s no closing PHP tag before the end of the document
    * no spurious closing comments tag (pay special attention to around line 11)

    just tossing out some ideas of where I would start looking.

  • #4 / Jan 31, 2012 8:33am

    Boyink!

    5011 posts

    Pretty sure that’s a EE1 plugin which won’t work in EE2.

  • #5 / Jan 31, 2012 8:41am

    mark186282

    290 posts

    They do have a EE1 version and a EE2 version listed on this page:

    http://expressionengine.com/downloads/details/allow_ee_code

    the EE2 version links to here:

    https://github.com/EllisLab/Allow-Eecode/blob/master/allow_eecode/pi.allow_eecode.php

    It looks like it’s using EE2 classes and formatting, so I don’t think that’s the issue.

  • #6 / Jan 31, 2012 8:51am

    Ataul Munim

    17 posts

    Mark you were spot on with asking me to check the source: it was a case of PEBCAK - I was right-clicking and using “save target as” for the php file in GitHub which downloaded a php file with the correct plugin name. I assumed this was the plugin, rather it was the generated HTML page of the GitHub site! So my original issue is fixed.

    I’m finding it difficult to use the plugin though - it’s listed in my Plugins page now, and I’ve added it to my template as shown in my first post. I want to use it as described in the second code snippet of my first post, where I use the short-name for the image uploaded when writing a post, but it’s just rendering a static “{entry_image_01}” when I check the source of the rendered page.

    I’ve tried different combinations of text formatting on the field where I’m using it, including “none” and “Allow EE Code” but nothing seems to make a difference.

    (Should this be listed as a separate issue, or is it okay to continue here?)
    Thanks for replying Mark and Boyink!

  • #7 / Jan 31, 2012 9:18am

    mark186282

    290 posts

    glad we got the first part working, now onto making it actually do what you need…

    forgive my lack of knowledge in this area, but I don’t totally understand your statement:

    ...where {entry_image_01} is the short-name assigned to an image file that has been uploaded, and is associated with the current post entry.

    where is this short-name assigned?

  • #8 / Jan 31, 2012 9:27am

    Ataul Munim

    17 posts

    Thanks Mark. I ‘ll start from the beginning, as perhaps I’m going a long way around doing something simple.

    I have 6 channel fields set up for images, which the author may or may not use. (If 6 fields is not enough for a particular post, the author can add more, as I’m the only author). The short name for each of these channel fields are assigned here, from “entry_image_01” to “entry_image_06”.

    When an author makes a new post, I want him to be able to upload images to the main upload directory, but then choose where to place each image in the post by putting the <figure> tags wherever he wishes; they shouldn’t be placed in fixed positions in the main template.

    I assumed that the “allow_eecode” plugin would let me use these short-names in individual entries. My desired outcome would be similar to a WordPress style blog, where the author can upload the images and the CMS would handle the organisation of files - e.g. put it in the images/year/month directory, and rename the file automatically if uploading two files both with the name “test.jpg” (though not necessarily in the same post).

    —edit:
    my use case is better described here: http://www.gradualism.co.uk/articles/make-adding-images-to-ee-entries-safe-and-easy/
    where I don’t mind the use of code in entries. I guess the simplest way would be to add the files, and put the absolute url in the img src attribute - would it be possible to use the “{site_url}” tag in entries so that if I move my site or change domain, it won’t break it later?

  • #9 / Jan 31, 2012 9:58am

    mark186282

    290 posts

    interesting dilemma… I totally get it - but don’t have an easy solution out of the box.

    1. are you using a wysiwyg editor (wygwam or similar?)
    2. are you entering content in the admin or safecracker?

    (just exploring ideas that you’ve probably already looked into)

    Are you familiar with the “channel images” module?
    http://www.devdemon.com/channel_images

    The mixing of that module with wygwam has given us the flexibility to upload images (as many as we want) and put them where we want using the wysiwyg editor.

     

  • #10 / Jan 31, 2012 11:00am

    Ataul Munim

    17 posts

    Thanks for your reply Mark.

    I’m using the generic editor available in the control panel when you click Content > Publish, with the formatting on the text area set to “None” as I don’t like the automatic parser, and I’ve got a few different classes for paragraphs etc.

    Actually I haven’t had a chance to look into these options, I purchased my EE license last week and only started creating templates a couple of days ago, assuming that I’d be able to reference uploaded images on a per-post basis. While the Channel Images module would be useful, I don’t think I can justify spending $65 in my case (the multiple fields already created work, if I don’t use all of them, that’s fine, and if I need more, I can add).

    If there’s no way of using the {site url} variable to prefix the site url in entries, then I think I’ll just use the absolute url and in the case where I change domains/hosting, use a SQL query to swap them out for the new url prefix.

    Thanks for your help, especially for the original issue 😊

  • #11 / Jan 31, 2012 11:30am

    mark186282

    290 posts

    You’re very welcome… sorry I don’t have a magic silver bullet for ya - but I’m curious on your outcome in the end.  After you experiment a little bit, and get a process working for you - come back and let us know the resolution.

    (also look into template variables for your {site_url} situation.  I also don’t like using anything that isn’t portable - these are parsed very early in the process and might be the quick fix for what you’re trying to do)

    I hope this helps - good luck to ya

  • #12 / Jan 31, 2012 3:06pm

    Kevin Smith

    4784 posts

    Hi ataulm,

    Glad you were able to get a lot of these issues sorted out. Based on what you’re trying to accomplish, would it not be easier to just insert images into your text field by using the File Chooser (the image button of the green tree)? It’ll bring up a list of all the uploaded files or let you upload a new file, and then allow you to choose the image you want to include. No need for EE tags or anything like that.

    See if that works for you!

  • #13 / Jan 31, 2012 4:14pm

    Ataul Munim

    17 posts

    Hi Kevin,

    I’ve attached a screenshot showing the page and fields available when I click Content > Publish. Is the file chooser something I’d need to add (and create a field for)? Bearing in mind I would prefer not using a WYSIWYG editor.

    Thanks 😊


    for now I’ve decided to manually organise my pictures into “images/yyyy/mm/” directories, and use absolute file paths for them - I’m assuming it’ll be something I can change with a sql query if needed.



    edit:
    Wow I just enabled the “show file chooser” which is exactly solving the problem 😊 Thanks man! Just need to create the folder structure to keep it organised chronologically 😊

  • #14 / Feb 02, 2012 7:13pm

    Kevin Smith

    4784 posts

    Glad you were able to figure it out!

    For any onlookers, here’s what you need to do to enable the file chooser for those text fields. If you edit that custom field’s settings (Admin > Channel Administration > Channel Fields), and you scroll to the bottom of the preferences, you’ll see a setting that says, “Show File Chooser”. Just make sure that’s engaged.

    Is there anything else I can help you with, atauim?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases