Quick Help: ExpressionEngine - php

Please forgive this question, I have just under an hour to get this done for a client and I have NEVER used Expression Engine before. I currently have multiple tabs open for the Documentation, Google etc... and am really struggling to find it. I don't have the time to go through all of them extensively for this.
This is what I need to edit:
When I log into the CMS there are three containers float next to each other; Create, Modify or Delete and View.
In the first one: Create. There is a link that says entry which when clicked slides down to reveal a plethora of options to create. One of them is Events. When I click events I am then taken to a page with multiple inputs and textareas etc..
What I need to do is this. I need to create a new option textfield there so the user can input a URL. Then I also need to be able to echo that out.
Cheers for the help folks

In your control panel nav bar, click Admin > Channel Administration > Channel Fields. You should see a list of "field groups". Likely one of them is called Events. Click on it, and you should be led to a list of existing fields in the Events channel. There should be a button on the upper right that says "Create a New Channel Field". Click that and you'll be taken to a form.
For Field Type you'll probably want to leave it as Text Input. Field label is what the end user will see on the publish form (ex. Event URL). Short name is what you'll use inside your templates to echo the url (ex. event_url). You can most likely leave all the other settings to their default values.
After you've created your field, you can now go to create a new entry in the Events channel, and you should see your new field in that form.
The next step is to edit your template. Go to Design > Templates > Template Manager. This will show you a list of all the templates on your site. You'll have to find your events template in this list (try searching for events). In this template you'l find your HTML and your "template tags". This is where you'd add your custom field for "echoing". Surround your custom field short name with one curly brace:
<p>LINK TO EVENT</p>
I hope this gets you on the right track.

Related

How can I get rid of the click off event on an autopicker with tags in a moodle form?

I am using the autocomplete element from the Moodle Form API on a Moodle form. I preload the autocomplete element with a list, set multiple to true, and tags to true. This allows the user to add elements to the list if they don't already exist. A user can add an element by typing in the text and either clicking enter or clicking off of the autocomplete element. This event will take whatever the text is in the autocomplete and add it to the list. I don't want an element to be made every time the user has entered text and clicks off of the autocomplete, rather just when the user has entered text and clicks enter. Is there a way to do this using Moodle's Form API autocomplete or should I go about this a different way?
There is no easy solution to this issue. However I believe I have started to find a way to do what you would like. If you go into lib\amd\src\form-autocomplete.js and head down to about line 728 (using Moodle version 3.7) you will see this line:
return createItem(options, state, originalSelect);
This is the line that triggers the creation of a new tag whenever the auto-picker gets its focus lost (click off). If you comment out this line, that click off event will no longer trigger that creation. However it must be noted that this will cause it to be disabled across your whole site, for all auto-pickers.
Obviously I do NOT recommend doing this, as with it being a core Moodle function it will most likely revert as soon as you update Moodle, causing many potential issues down the road. However, as this question has not seemed to get much attention, I wanted to add this just to give you and/or other people viewing this somewhere to start.
I am currently looking into creating a copy of autocomplete.php (the php element that mform uses for auto-pickers) and adjusting its calls to use a separate, slightly adjusted version of lib\amd\src\form-autocomplete.js. I will update you with any progress I personally make, but hopefully this information can get the ball rolling for you or other developers on this site.

Creating unique pages of a website by passing an sql key

The title may be a bit awful as I'm really not sure how to describe what I'm trying to achieve without using lots of words.
I'm currently building an events website. This website has the option for users to create their own events which can be added to a big list of upcoming events that other users have submitted.
What I want to do is be able to have a user create an event and have the details of the event stored in an SQL database (which I've successfully done), I want to be able to then have a large list of events on a separate page the details of which are pulled from the server dynamically using PHP and SQL (I've also successfully done this). The part I am struggling with however is being able to create unique pages (or a single dynamic page) that displays a more detailed look at the event, such as age restrictions etc etc, which cannot be displayed on the big list which displays all the available events.
I figured that this could be done using a unique eventID, which is something the SQL database already includes and autoincrements with each new event entry. What I'm really not sure about is how I'd be able to pass that eventID through the link to the more detailed page so that the detailed page can be created displaying all of the details of the event.
I'm not even sure if this idea will work at all. Would having a page with a unique URL that is created on event submission that has a more in-depth look at the details of the event be a better idea? How would I go about creating unique URL webpages that correspond to each event on event submission?
I'm really not sure how I need to go about this at all, so I need some help and pointing in the right direction.
Here's a kind of TLDR:
1) Events website
2) All events on the website are displayed on a single page that has minimal detail about each event (title, date, location) BUT has a link to a page that displays the event in more detail.
3) User can select an event from the list and click on that event's unique HTML link to more detailed page
4) More detailed page displays event in more detail by pulling event's unique information from the database
Feel free to ask any questions at all as I know this probably isn't the easiest idea to get across
When creating the links from the general listing page to the detail page, simply include the id in the link. For example:
<A HREF="mysite.com/detail.php?id=3>Big Event</A>
In detail.php then, you'll find the id in $_GET['id'].

How to add a form field to modx 2.2.14 manager pages

I'm trying to add the editiedon field to the modx manager pages so my users can edit the value using this bit of documentation as a start point:
http://rtfm.modx.com/revolution/2.x/case-studies-and-tutorials/adding-custom-fields-to-manager-forms
Which does work, but:
how can I make that a date/time field?
how can I place it in the settings tab of the given resource?
Isn't input type="date" the answer to the first question? I'm not sure how you would do the second part, unless you managed to get the rendered content and splice it in there somehow (unless theres som hidden specified method).
Otherwise, you could always solve it with regular form customization. You'll want to create a TV of type Date, and give it a custom default data through a snippet, that just fetches the current resources editedon value. I guess you only need to update the resource/update form set. Under the template variables tab of the set, make sure your TV is connected and change the region value of it to "modx-resource-settings"
There are two different ways which have their own pros & cons.
At first you can use template variable with Date type. It gives you correct ExtJS component for dates and you'll see calendar in TV's tab.
If you'll choose this method you have to create a plugin which invokes on OnBeforeDocFormSave event. There you can redefine modResource editedon property from your TV and it will be saved in proper way. Also you may invoke another event(OnLoadWebDocument). There you can set modResource editedon property from you TV if you want to see correct data.
Pros:
fast calendar integration to the one of modResource's tab
you can use Form Customization for security reasons. It's rather easy and from the box.
Cons:
Additional TV which complicates modResource updating process a little bit
Another method is more complicated (you need skills in ExtJS).
Create plugin which invokes on OnDocFormPrerender event. You can add JS to the modResource page there. Your scripts should render new custom tab to the document where you can add your special field with calendar. So there is special ExtJS component in MODX for these purposes. And of course you need events from first method for loading and updating editedon value.
Also you can just render special field to the existing tab instead of creating new tab and rendering your custom field to it.
Pros:
you don't need TV anymore
it's flexible
Cons:
it's more complicated and takes time
P.S. You can view Xlexicon github repo. There you can find example of rendering new tab and manipulation with modResource properties.
Also you can check modAvatar extra for MODX. There is an example of manupulation with existing tab.

Jquery select item from popup and post back to parent

In one of my projects, I have many different sections where I need to filter some data and select the required, for example - On newsletter page where I need to click a link to "add users" which opens up a popup window where I can search users by name, ID etc then check the checkboxes and click "Select". This adds their IDs (or maybe emails) in the hidden form on the Newsletter page.
Similarly, I need to attach a file to newsletter then I click on an another link which opens up a popup with list of files which I can search and then finally select one. I have similar other requirements in other sections of the website which means I have to write similar type of code again and again.
I won't mind duplicating code if it were to be used at one or two places. But I have more than 8-9 different sections where I have to select users, files, some other items etc so I was thinking if there was a generic plugin sort of tool which takes a url of the search page and returns the data back in a specific format to the parent opener window then I just include that code on each of these pages and just have to maintain one/two files only.
How would you handle this sort of requirement? Is there any JQuery plugin available which does similar thing?
I'm not aware of a plugin for this, but this Q&A looks relevant:
Open popup and refresh parent page on close popup
Perhaps you can be the hero who implements such a plugin, Mr user1421214!

How to make a dynamic, selectable list under a text field in a webpage (like Googles instant search)

I'm looking for a way to create a dynamic list below a text field on a web page.
This list needs to be selectable (by mouse click and arrow-down-key).
The selected item shall be in the text-field after selecting it.
It should look and behave like the google instant search.
I did finish the instant serach with this tutorial: http://www.w3schools.com/php/php_ajax_livesearch.asp
The only thing missing now is to make the list selectable and put the selected item in the text field. (after that the list shall disappear)
http://docs.jquery.com/UI/Autocomplete
http://developer.yahoo.com/yui/examples/autocomplete/ac_basic_array.html
And there are many many more to choose from. good luck :-)

Categories