-
☆ A M B ☆
- 24,524 Posts
Quote from: thinkweb at May 13, 2008, 09:03 AM
So how would one go about adding custom fields to edit page?
Thumbnail Name: [ some_file_name.png ]
Then that is saved in the database somewhere?
That is what TVs are for. Custom fields added to the document editing page. In this case, you would create a TV with an input type of Image, and an output widget of Image. Then put the [*TVname*] tags wherever you want the image to appear.
Awesome, is there any in depth reading on TV’s and adding a custom field to the manager?
Still very confused and I apologize.
Ok so say I wanted to make a portfolio page for a web design company where you can add "Project Name" "Project Image" "Project Description". Then loop through those 3 fields on one page and also give them their own pages, what would be the basic instruction for that?
-
☆ A M B ☆
- 24,524 Posts
Make a folder/container document named Portfolio. Make individual project pages under that parent document. Use Ditto to display the listing with links to the individual pages. Each individual page would have an image TV for a thumbnail image which would be used in the Ditto template. The project name and description would be the individual document’s Title and Summary (introtext) fields, also used in the Ditto template. See
http://ditto.modxcms.com for more about using Ditto. The Wiki also has some good articles on different ways of using Ditto.
Quote from: sottwell at May 09, 2008, 11:25 AM
In a nutshell:
Modules are for adding features to the Manager, such as a newsletter management feature.
Plugins are for interrupting normal processing to add custom functions (whether to parsing a document to generate a web page, or processing a user login, or processing the saving of an edited document, among the many processes that can be interrupted). This avoids the usual necessity to hack the core code.
Snippets are PHP code whose return values get inserted into the web page. Similar to putting <?php someFunction(); ?> in an HTML page.
Chunks are HTML code or raw text that gets inserted into the web page. They can contain snippet and TV tags.
TVs are sort of a blend of snippets and chunks that are related to specified templates and can be edited on a page-by-page basis. They are closely related to the default document variables such as [*pagetitle*] and [*content*], which are based on the database fields in the site_content table.
Very nice. Shamelessly stolen for bobsguides.com.
Hi,
interested in specific use of Modules. Plugins, Snippets etc...
Which is the best place to put php functions and variables to be used inside (-shared by-) snippets?
Let’s say, I’ve got two snippets whose php code calls a php user-defined function.
Is there a unit where I can define the function to be called by those snippets?
Til now, I put the functions in a php file, then include_once that file in each snippet. But I think that’s not elegant nor functional. The best would be an automatic inclusion by modX before running any snippet... but I don’t know how... something like a sort of plugin allowing every snippet to use those functions.
thx in advance
Create a plugin (resources > manage resources > plugins) and make sure you tick the "OnParseDocument" system event (3rd tab). The code can be as little as include_once(’assets/snippets/loadSomeStuff.php’);