Storing a cfwindow as a coldfusion module - coldfusion

I'm a coldfusion newbie. I have a cfwindow that performs various tasks for me with a form that rests inside it. All that works well, except now I want to add the cfwindow to many pages, and I'd like to do so with some kind of module that can reside in one spot for easy editing in the future. Does coldfusion have anything like a module? Thank you.

Yes, ColdFusion has lots of things like modules:
Cfinclude just includes another CF page in the current page
CustomTags
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=reuseCode_2.html
are very powerful
ColdFusion components can have display as well as business logic in
them -
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=UseFlexDataService_05.html

Related

Template with TYPO3 v10

I would like to do a project with TYPO3 v10 I'm new with this CMS and I need to create different templates for different pages but I don't understand which code I need to change.
I already install a sitepackage from this site https://www.sitepackagebuilder.com/
It work well but I need to create my own templates and I want to edit the content of my templates in the back end administration like in the picture.
I hope I'm clear
thanks for help :)
I am not sure if there is a misconception in the question or if I have interpreted incorrectly. In any case, I hope this helps:
It is important to differentiate between content + template in TYPO3:
content
In the screenshot posted in the question, you see the TYPO3 backend, which is a view for editing content, administration etc. There you see the page module is opened in the left column (1), you see the page tree in the middle column (2) and the page layout for editing content on the selected page in the right column (3). Here, you can insert and edit the content, that will be displayed on a page.
Template
In TYPO3, the template is what makes up the automatically generated parts of the page such as header, footer, menu, breadcrumb etc.
It work well but I need to create my own templates and I want to edit the content of my templates in the back end administration like in the picture.
Editing the template in the backend with a Wysiwyg ("what you see is what you get") editor, similarly to editing the content is not really possible in TYPO3 AFAIK - at least not out of the box. For this, you would need a template builder. The only thing I have seen so far that comes close to this is toujou (I am not affiliated with them, just wanted to mention it). They have something which you could call a website builder. But AFAIK, you can't download it, they provide this as a service.
The sitepackage builder - as far as I know - pretty much just creates a sitepackage based on the bootstrap package extension which you would have to further modify by editing the files.
What you can also do is edit the TypoScript in the backend. Just go to the "Template" module in the left column. But, this made more sense in the past, because a lot more was done with TypoScript. Nowadays, you usually use a combination of Fluid and TypoScript and you can't edit the Fluid files in the backend.
While in the past, a lot more was done in the backend or could be done in the backend, everything is moving towards maintaining changes in files and extensions, where the template is maintained in a sitepackage. For some things both is still possible (backend and extension), e.g. backend layouts, TypoScript etc.
Moving the configuration + templates from the backend (and storing them in the database or as files) to a dedicated extension has several advantages:
Every configuration etc. is bundled into one extension, this makes it easier to install in another site, on a testsystem, exchange it etc.
the sitepackage can be put in a version control system (e.g. git) which has a bunch of other advantages such as easy rollback to a previous version, referencing issues etc.
The downside is that you need more technical expertise and there is a learning curve.
see also:
The Anatomy of Sitepackages
Sitepackage Tutorial
I understand that it might be pretty cool to assemble a template in the backend - just like you can do with the content. Maybe someone else knows how to do that with TYPO3.
You can also check out these resources which seem to go in the direction of what you are looking for:
TYPO3 extension mask (documentation)
T3terminal
in the official documentation you can find the structure of folders where the files for your layout are stored.
More details on fluid templating in this document
Now you want a possibility for editors to select between different page layouts. An often used way is to use the possibility to select different backend layouts and select a frontend layout accordingly.
This is shown in the video on this page or in the documents you can find if you uses the searches on that page.

opencart create new module with order

I am new to opencart and want to create new extension module. After order placed and payment process completed after that I need to call 3rd party API.
So, Is there any hooks (like WordPress or Prestashop) that I can apply and use into my module files?
I am currently using opencart version - 2.3.0.2
OpenCart doesn't have any hooks, only events system, which is pretty weak. Instead it uses VQMod. This is a pretty powerful tool for developers, who know some PHP. It works similar to WordPress hooks, but gives you unlimited options.
Hooks use certain points in the code or fire certain events, but with VQMod you can put your code literally anywhere. You only need to find the desired line and put your code before or after it, even replace it, if necessary.
If you're familiar with WP hooks and filters, I'm pretty sure you'll handle VQMod well.
There are three following way :
Opencart Events
Vqmod
Ocmod
PS: I prefer to use ocmod.

Needing suggestions for modular Coldfusion app development

I'm starting a a new application, and want to concentrate on making it modular. What I mean by that is that is that in my head I envisage some basic facilities log on, user roles, layouts etc but then I am looking to be able to be able to add self contained "chunks" of functionality e.g. document repository and upload, diary and reminder service .. whatever.
How I've been laying out apps so far is simply everything in root, separate subfolders for images and cfcs, sticking to naming conventions for variable and query names etc, all database interaction via cfcs, doing all my processing at the top of the page, then a comment line then display/page layout below that.
I have tried and failed to get my head around the various frameworks out there, but I just get paralysed with indecision and confused about whether I'm doing it "right". Is there a way of working that has some acceptance of being a useful methodology without getting in to the whole official "framework" thing?
Then you probably want to separate your presentation layer from the core as much as possible. A good and popular way to do this that is picking up speed very fast is following the MVC (model-view-controller) pattern
http://en.wikipedia.org/wiki/Model%E2%80%93View%E2%80%93Controller
This will allow you to modulate functionalities into controllers that are completely seperate from layout, etc. The controllers can then more easily be integrated into other projects as need be.
I know you said you didn't want framework and you most certainly don't need one but I strongly suggest it for larger application such as what you are describing. Some can have so many rules and what not that they seem to get in the way a lot. One that I like, which is based on Ruby on Rails called CFWheel (http://cfwheels.org/).
It's pretty much there to help you structure stuff, you are free to follow the "normal" way or not it won't really stop you. Have a look at the screencasts here: http://cfwheels.org/screencasts
Model Glue is an excellent CF Framework. The google group support + docs are great.
FW/1 is another simpler framework to start learning, not sure about the docs at this point.
Frameworks are definately the way to go. Once you get your head around them, they just feel "right". They tend to make you write better code, and having used a coldfusion framework for a year or so now, I can honestly say I'll never go back to not using one 8-)
Honestly, the frameworks can lead to analysis paralysis quite easily. You can easily over think things. Here is what you do, keep it simple and just bang away at the keyboard. Use your "own" framework. It might not be pretty, but you'll get it eventually and you'll see why the other frameworks exist.
Here is how you start:
Create folders layouts and views. Put all your page layout stuff in the layouts folders (you'll probably have only a few and maybe even one layout)! Put all of your view stuff in the views folder (this will probably look like what you've been doing with a bunch bunch of files not very well organized). The key is that you won't have ANY page processing "top of page" code in your view files.
Your index.cfm will be the only .cfm root. Use a URL variable "event" = action to make your framework go.
In your index.cfm, use a giant cfswitch to determine which "top of page" code to execute (this will be a giant "controller").
mysite.com/index.cfm?event=contactInfo
<cfswitch expression="#url.event#">
<cfcase value="contactInfo">
<top of page code>
<cfset structLayoutInfo["pagetitle"] = "XYZ Contact Info" />
<cfmodule template="/layouts/mainlayout.cfm" attributeCollection="#structLayoutInfo# >
<cfinclude template="/views/contactInfo.cfm"/>
</cfmodule>
</cfcase>
.....
</cfswitch>
Combine this with the cfmodule tag to load your layout. So, all your page requests come in through index.cfm. Index.cfm will do all the top of page stuff and then do a cfinclude to the appropriate view in your views folder. Use the cfmodule tag to load your layout (check out the tag.execution mode stuff for headers and footers).
You'll keep adding features and adding features to your framework. You'll probably move the index.cfm code to a controller folder with a bunch of CFCs that call your database CFCs.

Best way to integrate PHP forum into Django site?

Suppose you are running a Django site, and have a legacy PHP forum to support and integrate into your site, since current Django forum solutions are not mature enough.
What is the best way to do this?
Currently I have a simple view, which renders a very simple template which extends my site's base template, and the content area has nothing but an <IFRAME> which holds the forum as its src. A small jQuery function is used to maximize the <IFRAME>'s height (once it finishes loading) so as to contain 100% of the forum content.
But all of this sounds pretty awkward. How would you go about this?
There are a few options. None are ideal (but mixing two platforms never is!)
Use iframes as you've suggested (bad as the address in the address bar is always that of the django page and if somebody copes a link off the forum, it will be the PHP forum, not the django holder)
Use iframes but instead of using the same src all the time, parse the URL and append the relative bit onto the src of the iframe. ie if django sees /forum/this-url, set the src to http://forum-address/this-url and make sure all your links target parent. This has the advantage of showing the correct link in the address bar at all times (rather than it always being /forum/). You'll need to hack your forum for this to work.
Proxy the content and inject it into the page properly. You'll need to pass cookies and it might get really messy but in most terms, this is a great way to integrate things because your links will always be correct. You'll need to butcher your forum theme to strip out everything outside and including the <body> tags.
Theme your forum in the same way as the Django site. This would give best performance but you might have issues if you use dynamic stuff in your django template. An option to get around this is by having the django template cache things to memcache and using php-memcache to pull them out into your forum template.
I have done both 3 and 4 in the past. I used 3 for a very simple form (so didn't have to deal with cookies and sessions as you will). I used 4 for integrating a FluxBB forum into a Wordpress install. Both PHP but it would be uber bloat to load FluxBB inside Wordpress. I cached the dynamic template things into memcache and pulled them out in the forum template.
For this, I would probably suggest going with #4. It's a pain in the arse having to maintain two themes but it's by far the fastest performing solution.
When I read the question summary I immediately thought that you would need some kind of script, which could be linked to a signal via the Dispatcher in Django, to syncronize the user database from your Django site to the forum. This would keep the authentication side of things in check - but you still need to do one of the things that Oli has suggested, to make them look the same.
Themeing will probably be the least hassle-free route, but that's not to say it will be easy!

How to implement wiki-style edits in your web-application?

In a web application I am developing, I wish to implement wiki-style edits (where each and every edit is saved, can be compared, and users can rollback edits easily).
What is a good way of implementing this without re-inventing the wheel too much?
Thank you in advance.
I believe you're really seeking a Content Management System (CMS), of which a Wiki is a specialization (IMHO).
Googling 'CMS Open Source' brings as its top hit:
Open Source CMS, try before you install
Joomla
Drupal
Wordpress
And a lot of other information.
Commercially, I really like Atlassian's Confluence. Wiki like markup, editing history, easily attach documents and now supporting editing in Word, Excel & Powerpoint.
use a cms like tikiwiki which is very close to what you plan todo.. :D