How can I get a link to include the template? I already got the .cfm file copied over to the site & code is working. Now how can I get the theme included in the url link just like the template from the homepage? I am working from the default merced theme. The url I have is: http://sitename/index.cfm"what goes here to include the template"?=somefile.cfm
* Last updated by: sc1227 on 5/15/2012 @ 11:10 AM *
Support Forum
Page: 1
Created on: 05/15/12 10:31 AM
Replies: 9
sc1227
Joined: 05/08/12
Posts: 49
Include Template in Link
05/15/12 10:31 AM
gshepert
Joined: 11/30/10
Posts: 61
RE: Include Template in Link
05/16/12 9:50 AM
Not sure what you mean by "the template", or what it is you are trying to achieve.
If you are trying to "include" a coldfusion file in a Mura CMS page, then you want to:
- put the file in the /[siteid]/includes/display_objects/custom folder, i.e. "/[siteid]/includes/display_objects/custom/myfile.cfm"
- put [Mura]$.dspInclude('display_objects/custom/myfile.cfm")[/Mura] in the content body for the page
... now, if you are trying to do this dynamically (i.e. letting people choose which coldfusion file to render by putting it into the url), I would really strongly recommend you don't as it could potentially open a security hole in your site. If this is what you are trying to do, I can explain this in a subsequent post but that would be really dangerous without some good code around it.
If this isn't what you were looking for, if you could include file names, file paths and a description of what you are trying to do (instead of just how you are trying to do it), I can probably give you a quick answer to your issue.
sc1227
Joined: 05/08/12
Posts: 49
RE: Include Template in Link
05/16/12 1:35 PM
To answer your question, I was trying to do it dynamically. But with the security hole being explained, I ll have to do it within Mura in order for the template to display from the page. Thanks!
Another question about multi forms before getting to the final result.....
I have a Phone List search form created & working outside of Mura. What is the best & easiest way to incorporate this into Mura? Put all forms on one page or create a page for each form?
3 forms: search1.cfm; search.cfm; results.cfmI have a form that chooses to choose by first name or last name.(search1.cfm) Then hit submit. Then takes you to a different form where you type in the name then hit submit.(search.cfm) Then final form shows the results. (results.cfm) I have been modifying the form action="url address" but its become confusing when creating a form for each page. ????
Please advise as I am a Mura newbie. I hope I don't have to recreate the form in Mura in order for it work whereas the form has already been created outside of Mura. Thanks!
gshepert
Joined: 11/30/10
Posts: 61
RE: Include Template in Link
05/17/12 6:20 AM
The "best" way would probably be a plugin, but I'll give you the "easiest" way as that is much simpler to explain.
- create a folder in "/[siteid]/includes/display_objects/custom" called "phonelist"
- create a file in the folder called "main.cfm" i.e. "custom/main.cfm", with the following code:
<!--- main.cfm ---> <cfparam name="url.page" default="search"> <cfswitch expression="#url.page#"> <cfcase value="search1"> <cfinclude template="search1.cfm"> </cfcase> <cfcase value="results"> <cfinclude template="results.cfm"> </cfcase> <cfdefaultcase> <cfinclude template="search.cfm"> </cfdefaultcase> </cfswitch>
(obviously I don't know the exact layout of your program, so you might have to adjust the above to match your needs).
- then put the rest of your application files in the same /custom/phonelist directory.
Now, create a page in the Mura Site Manager called "Phone List" and add the following to the body content:
[Mura]$.dspInclude('display_objects/custom/phonelist/main.cfm")[/Mura]
Essentially what we've done is made "main.cfm" the hub of your application. Now, to load a particular page, you just have to have ?page=X in the url, i.e.
http://www.somerandomsite.com/phone-list/?page=search1
... or ...
http://www.somerandomsite.com/phone-list/?page=results
You should be able to build your application around this.
As for building a plugin, there are a couple of ways to do this, but I'll start by pointing you to http://www.grantshepert.com/post.cfm/mura-cms-how-to-write-a-plugin-from-scratch, it's an older post but should be enough to get you started.
* Last updated by: gshepert on 5/17/2012 @ 6:20 AM *
sc1227
Joined: 05/08/12
Posts: 49
RE: Include Template in Link
05/17/12 8:59 AM
I am replying to the post that you replied to below........
Now, create a page in the Mura Site Manager called "Phone List" and add the following to the body content:
[Mura]$.dspInclude('display_objects/custom/phonelist/main.cfm")[/Mura]
Essentially what we've done is made "main.cfm" the hub of your application. Now, to load a particular page, you just have to have ?page=X in the url, i.e.
Underneath the phone-list main page, I created another page "Search" with the [Mura]$.dspInclude('display_objects/custom/phonelist/search.cfm")[/Mura] on the page. When user clicks submit on the phone-list main page how can I get it to go to the next search form page? Do I put it in cfform action="http://www.somerandomsite.com/phone-list/?page=search" I tried this and it didnt work. What am I doing wrong?
http://www.somerandomsite.com/phone-list/?page=search1
... or ...
http://www.somerandomsite.com/phone-list/?page=results
You should be able to build your application around this.
gshepert
Joined: 11/30/10
Posts: 61
sc1227
Joined: 05/08/12
Posts: 49
RE: Include Template in Link
05/17/12 9:49 AM
Did I need the following code for the load page to work?
<cfparam name="url.page" default="search">
<cfswitch expression="#url.page#">
<cfcase value="search1">
<cfinclude template="search1.cfm">
</cfcase>
<cfcase value="results">
<cfinclude template="results.cfm">
</cfcase>
<cfdefaultcase>
<cfinclude template="search.cfm">
</cfdefaultcase>
</cfswitch>
I am not having a template issue now. It's the cfform action to load next page or form when user clicks submit. I think the domain name is correct. Here is what I have:
Main Page (Phone List):
Contains the mura dspinclude search1.cfm mura tag that displays the main form. After user make selection. Clicks submit! Got the <cfform action="http://mysitename/index.cfm/phone-list/?page=search" Method="POST" onSubmit="return check_form()"> (Search is the name of the 2nd page underneath the Phone List Main page. It stays on the main page instead of going to next page.
Second Page (Search):
Contains Mura tag: mura dspinclude search.cfm mura tag that displays the 2nd form cf code. Search.cfm file includes <cfform action="http://mysitename/index.cfm/phone-list/?page=results" Method="POST" onSubmit="return check_form()">
Last Page (Results)
Contains Mura tag: mura dspinclude results.cfm mura tag.
Hope this helps & that you are help me futher to get the page submit to work properly.
gshepert
Joined: 11/30/10
Posts: 61
RE: Include Template in Link
05/17/12 10:31 AM
It sounds like you renamed or used one of your files as the main.cfm file, which isn't correct. Main.cfm is separate from the rest of your application.
/display_objects/custom/phonelist/main.cfm
Has the code block above (with <cfparam>/<cfswitch>). This is the only file you dspInclude(). This is a new file, not one of your application's.
/display_objects/custom/phonelist/search1.cfm,etc.
These contain only your code, nothing from the posts above. You do not dspInclude() these files anywhere, as they will be included via main.cfm.
There should only be one actual Mura page, in this case named "Phone List", and it should have only one dspInclude() as follows:
[Mura]$.dspInclude('display_objects/custom/phonelist/main.cfm')[/Mura]
Any links/form posts/etc. in your application should point to the "Phone List" Mura page, with the appropriate ?page=X to reference which main.cfm will use to include the appropriate page.
Just to be clear: the main.cfm file should exist, should be the only one containing the <cfparam>/<cfswitch> code, and should be the only file that you dspInclude().
sc1227
Joined: 05/08/12
Posts: 49
sc1227
Joined: 05/08/12
Posts: 49
RE: Include Template in Link
05/21/12 1:42 PM
I have a similar project that I am having trouble with coding in Mura. But it's only one form. I have a folder titled event_rsvp w/ 3 files: main.cfm; events.cfm; events_script.cfm. Main.cfm has
<cfparam name="url.page" default="events"> <cfswitch expression="#url.page#"> <cfcase value="events_script"> <cfinclude template="events_script.cfm"> </cfcase> <cfdeafaultcase> <cfinclude template="events.cfm"> </cfdefaultcase> </cfswitch>
events.cfm is the event rvsp form which has [code] <cfform action="http://sitename/index.cfm/event-rsvp/?[age=events_script"> Then when user clicks submit it takes them to event_script.cfm which just displays thank you for your rsvp.
The issue I am having is that it doesnt take me to the events_script page nor update the rsvp form with the new entry. Error: -3035
Message [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.
Form works fine outside of Mura. Any suggestions?????
* Last updated by: sc1227 on 5/21/2012 @ 1:57 PM *
Page: 1
Please login to post a response.