View and download files uploaded via a form in Kentico - transformation

In Kentico, how can make it possible for site users to see and download files uploaded by other users through a form?
I make a form in Kentico CMS. Users can fill and submit it properly. My form has an upload file field.
I made a new page to show the content of the submitted forms. For this, I use a "Query Repeater with effect".
It seems the Query works well. I write a Transformation to show each record in a table format.
All records and fields appear well except the file field. I can not find a way to generate a link of uploaded files to assign it to the href attribute of a link tag. I use code like this
Download File"
The problem with this code is the <%# Eval("UploadFile1") %> returns a string like this
94e5b02d-1bcd-4341-9930-6e5ef1029d8b.pdf/MyFileName.pdf
How can I solve this problem?

When using the /CMSPages/GetBizFormFile.aspx you need to supply the file name and site name as the query string parameters. The file name is actually the GUID of the file + the extension. So, the link should look like this:
~/CMSPages/GetBizFormFile.aspx?filename=3560f3ed-6a12-444e-9fc6-2447fc903a23.jpg&sitename=SiteName
The thing here is that the GetBizFormFile is checking the access - user must be logged in, editor and must have permissions for forms module assigned.
If you want to create a public accessible link, you will need to compose the link directly to the disk location of the file (assuming that the folder on disk is not secured). The default location is ~//BizFormFiles. You can customize the location in Settings -> System -> Files -> Custom form files folder. This means, that using the GUID stored within the file upload field, you can compose the link like:
~/SiteName/BizFormFiles/3560f3ed-6a12-444e-9fc6-2447fc903a23.jpg

One of my friend suggested a solution that is works well!
1- at the first get the access to Everyone to read form records. Applications>Permissions>Module>forms
get the access to Everyone
2- the code for transformation:
<asp:PlaceHolder ID="ph1" runat="server" Visible='<%# IfEmpty(Eval("UploadFile1"), false, true) %>'>
<br>
<a style="color:blue;font-weight:bolder" href=<%# "https://example.com/CMSPages/GetBizFormFile.aspx?filename=" + Eval("UploadFile1").ToString().Split('/')[0] %>>Download File: <%# Eval("UploadFile1").ToString() == "" ? "a" : Eval("UploadFile1").ToString().Split('/')[1] %></a>
</asp:PlaceHolder>
the first line is for show nothings if there is not any uploaded file.

Related

Is it possible to identify file name passing url in magento?

How to identify coding having this file at magento .
For example,
Link Mean
how to identify which file its denotes ?
http://localhost/index.php/about-magento-demo-store/ is not a file, it's CMS page content which is actually a row stored in the cms_page table in your database that gets filtered through a template to produce html page content that is pushed to your browser.
Look under the CMS=>Pages menu, you'll find a grid and if you search in the url key column for about-magento-demo-store, you can find the page content there.
Magento's content does not exist as static pages, it is data stored in the database that gets selected, filtered through templates and assembled into HTML that gets final styling from CSS. It only becomes a page, once it is downloaded by the web browser.
1)Url redirects
look at the core_url_rewrite table and find the url that you requested.
if you find it, and target path starts like catalog/category/view/id/5,
that means catalog module, category controller, view action which you can find in
app/code/core/Mage/Catalog/controllers/CategoryController.php the method is viewAction.
2)Cms Pages
it can be a cms page
3)One of modules controller
It is the best way to install a profiler and see which controller handles your request.

trying to find a file to edit the div information

So we have a section on our website (category menu) which was modified to include a custom menu system. in the file top.phtml i found the following code
<div >
<?php //echo $_menu;
echo $nf_menu;
?>
</div>
The code inside the div's is calling for the menu, but i need to edit the actual code of the menu as it has inline styles for z-index applied to it and i need to adjust the z-index number.
Where would i find this menu. does that php code indicate where the file may be? Our coder is gone so we are not sure how they did this.
Based on the very limited information you've provided, there are basic ways of finding out where specific code is being generated in Magento (or any other scripting/php based framework).
View the html source (output) of your menu in a browser and find a piece of the menu HTML that would be unique. An example can be a unique class name or something that will set it apart from everything else.
<ul class="nf-menu">
<li>...
Do a site-wide file search for the unique reference you found in step 1. For example, search for <ul class="nf-menu"> or just nf-menu.
Don't know how to search for text in a file? Use the resources you have available to learn how:
For Linux based machines, see Finding all files containing a text string on Linux
Or if you have the files locally, use an IDE program such as phpStorm or Dreamweaver that includes a folder search for files containing a string of text.
Once you've found the file generating the code, simply make the modifications. I'd recommend making a backup of any file you modify so that you can revert to it if you're changes don't work as intended.

How we call "Pages" name in Dropdown in Signup form of PHPfox?

In PHPfox, i want to call "Pages" name in drop-down in Signup form. Reason for calling "Pages", Actually i have created many pages for college name & that are saved in database. So if someone comes for signup, i want to show them college name in drop-down (which are basically "Pages").
Please help me.
Thanks in advance.
You will need 2 plugins, one to show the HTML and one to process what to do with the user input:
1) Make a plugin that fetches the pages, maybe the hook user.component_controller_register_1 or another in that controller would do but otherwise you can always use a low level hook like run_start and check if its the section where you want it.
To show the HTML you have 2 options: include a JS file to populate the sign up form with anything that you want, or if you have a custom template you can just assign the array to the template variable and look through it in your template.
2) Once the html part is showing and working make a plugin for the sign up routine, I think the hook user.service_process_add_1 should be enough given its location.
Dont forget that the input name for the signup is an array, so your drop down needs to look somewhat like this:
<select name="val[my_dropdown]">

How can I display an XML feed without any template code in Joomla?

I'm trying to display an XML feed in a custom Joomla 2.5 component's view/layout, but the XML is rendered as a regular layout inside the site's HTML template. How can I display the XML without any template HTML code?
(The trick to include tmpl=component in the URL from this related question doesn't help, there's still some HTML output from the template that ruins the XML.)
I would prefer a solution that only involves code changes in my custom component, like in Symfony when you call the method setLayout(false).
The only solution I have found is to create a file in the current template folder, e.g. "xml.php", and put only this in the file:
<?php
$document = JFactory::getDocument();
$document->setMimeEncoding('text/xml');
echo '<?xml version="1.0" encoding="UTF-8" ?>';
?>
<jdoc:include type="component" />
Then I can append tmpl=xml to the URL.
[edit]
My bad, I made an assumption and you know what that gets you.
Joomla! 1.6->2.5 you can create an alternate output format for an existing view by:
calling the view with a format parameter attached e.g. &format=json
creating a matching view class file e.g. view.json.php that can sit alongside the standard view.html.php file for you view.
The view.yourformat.php file can use your existing controllers and template files in the normal fashion.
Don't forget to add either &tmpl=component or &tmpl=raw to your query string so modules etc don't load as well.
tmpl=raw won't load the html body surrounds or template, only the main component.
[/edit]
From Joomla! 1.6 onward (including 2.5) there is built in support for controller formats ie. you create a controller for the output format you want.
Normally a controller would be named for each view:
/components/mycomp/controllers/myview.php
A XML version of the controller would be name:
/components/mycomp/controllers/myview.xml.php
A JSON version would be:
/components/mycomp/controllers/myview.json.php
To call a particular format version of a controller you simply add &format=theformatyouwant to the URL parameters, so in your case &format=xml
This is discussed in this document from 1.6 days - I used it as a basis for several of our components that have JSON and ics requirements.
This issue drove me crazy a couple of times.
After much frustration, the simplest solution is the one suggested by cppl. In your query
string put the following variables:
format=yourcustomformat
view=viewname
Let say you want json output from a view called json.
Create a veiw folder with the name of your view
json
And a file inside that folder called
view.json.php
Then in your url string you include the following url parameters seperated by the & symbol:
index.php?option=com_mycomponent&format=json&view=json
cppl is correct that this loads a non-html view. However you don't have to put the tmpl parameter in at least in 2.5. If the view name is not view.html.php then 2.5 seems to not include the assigned site template in the response. I think because the view is not veiw.html.php it assumes raw output and does not include the template. I tested this with both an ajax call and a direct url call to the view and in both cases all I got back was the component output. Yeah!
If someone knows where this issue is well documented by the Joomla folks please post!

Why is my menu item resulting in a file not found error in Joomla?

I have a new component called com_location. It has a single model,
controller, and view. If I go to the page URL manually (i.e.
mysite.com/index.php?option=com_location&view=location) it displays my
view correctly (all the view does right now is display a table
containing a bunch of records from the database.)
However, when I add a menu item of type Internal Link, it doesn't
work. I select Internal Link, then Locations -> Location - >Default
Layout (my only choice.) I set the title to Find a Community, and the
alias to find-a-community. The generated link shown in the Link input
field (non-editable) is index.php?option=com_location&view=location -
exactly the same URL I can type in manually.
When I go to my front-end, the Find a Community link is there;
clicking on it produces the URL mysite.com/find-a-community, and
instead of my component, I get an error message: "The requested URL /
find-a-community was not found on this server."
I do have search engine-friendly URLs enabled in the global
configuration.
Help?!
If you disable SEF urls does it work? If so, you will need to write a router.php file
http://docs.joomla.org/Routing

Resources