https://wiki.creativecommons.org/index.php?title=Cchost/developer/Custom_Listings&feed=atom&action=historyCchost/developer/Custom Listings - Revision history2024-03-28T10:28:18ZRevision history for this page on the wikiMediaWiki 1.30.0https://wiki.creativecommons.org/index.php?title=Cchost/developer/Custom_Listings&diff=19589&oldid=prevFourstones: New page: Category:ccHost Category:ccMixter Category:Developer Category:Software Category:Technology {{draft}} {{lowercase}} One of the first things that many sites want to custo...2008-11-04T12:29:07Z<p>New page: <a href="/wiki/Category:CcHost" title="Category:CcHost">Category:ccHost</a> <a href="/wiki/Category:CcMixter" title="Category:CcMixter">Category:ccMixter</a> <a href="/wiki/Category:Developer" title="Category:Developer">Category:Developer</a> <a href="/wiki/Category:Software" title="Category:Software">Category:Software</a> <a href="/wiki/Category:Technology" title="Category:Technology">Category:Technology</a> {{draft}} {{lowercase}} One of the first things that many sites want to custo...</p>
<p><b>New page</b></p><div>[[Category:ccHost]]<br />
[[Category:ccMixter]]<br />
[[Category:Developer]]<br />
[[Category:Software]]<br />
[[Category:Technology]]<br />
{{draft}}<br />
{{lowercase}}<br />
One of the first things that many sites want to customize is way that uploads listings and upload pages appear on the site. The typical scenario for the first 4 versions of ccHost goes something like this:<br />
<br />
*A developer does some gifted reverse engineering and finds the ccHost default listing page and hacks away directly at that template.<br />
*A short time later that same developer is filled with regret.<br />
<br />
In ccHost 5 we tried to make it a less frustrating task with better results. The upload pages and upload listings are actually just query API templates. Therefore, before you get any further, we ''strongly'' recommend that do the [[Cchost/Custom_Query_Templates|query template walk through]]. This should take you about 20 minutes, but it will be well worth it and make the job of making your custom listings go much smoother.<br />
=Upload Page=<br />
The 'upload page' is the template that ccHost will use when someone has requested to see the details of upload using the '''files''' command. For example: <nowiki>http://ccmixter.org/</nowiki>'''files'''<nowiki>/victor/1134</nowiki>. This section explains how to create your own version of that and hook it up into the system.<br />
==Step 1. Create a Template==<br />
===Creating from scratch ===<br />
Starting you own version from scratch may be more work up front, but you will have a lot more control over the output of your own site this way. If you are familiar with HTML/CSS it will be much better and easier than you may think. Just sayin.<br />
<br />
To start your own customized Upload Page, follow the instructions in the [[Cchost/Custom_Query_Templates|custom query template walk through]] to create a new template based on the 'details' template in the Hello World example.<br />
<br />
=== OR Hack the system Upload Page===<br />
Even if you plan on hacking through this, we ''still'' highly recommend spending 20 minutes with the [[Cchost/Custom_Query_Templates|custom query template walk through]] to understand the architecture of how ccHost is displaying records.<br />
<br />
The absolute worst thing you can do is hack directly on one of the files under '''ccskins'''. That will never pay off. You have been warned.<br />
<br />
*Copy '''ccskins/shared/formats/upload_page_shared.tpl''' to '''<local_files>/skins/custom_upload_page.tpl'''<br />
*Optionally copy the <'''style'''> block from '''ccskins/shared/formats/upload_page_wide.php''' (or the ''narrow'' version if that's what you prefer) and put that near the top of the file.<br />
<br />
==Step 2. Edit the meta header==<br />
Make sure you have the following to the top of the page:<br />
<br />
%%<br />
[meta]<br />
type = page<br />
desc = _('My custom upload page')<br />
dataview = upload_page<br />
[/meta]<br />
%%<br />
<br />
*'''type = page''' tells ccHost this template is available for use as the Upload Page (but doesn't select it, you'll do that later)<br />
*The '''desc''' is strictly for your and the site admins' benefit so you can recognize this template.<br />
*We select '''dataview = upload_page''' because there are many fields not in the '''default''' dataview that will be helpful when displaying all the details of the record<br />
<br />
==Step 3. Select your Upload Page template into the system==<br />
You need to inform the ccHost configuration that you intend to use this page as the template when a user browses to a upload using the '''files''' command.<br />
<br />
*Browse to '''<your_installation_root>/admin/skins/settings''' <br />
*At '''Upload Page Format''' select ''My custom upload page''<br />
*Click on the '''Submit Basic Skin Settings''' button.<br />
<br />
==Step 4. Confirm your template is setup properly==<br />
Browse to '''<your_installation_root>/files/<user_name>/<file_id>''' to make sure it's your template that is set to that command.<br />
<br />
HINT: Any files link will do, like in the Sidebar Extra 'Latest Uploads'.<br />
<br />
==Step 5. Fill out your template==<br />
Using the '''%inspect(#R)%''' macro syntax you can see what variables are available for display</div>Fourstones