As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
In our application design, we want to introduce the VanityURL concept to the user. VanityURL will be a custom meta for the page. The broker api which queries the page by URL does not work anymore as the vanity url is not the one in the PAGE table. The solution we came up with is to query the page id by using a CustomMetaKeyCriteria and CustomMetaValueCriteria and it worked for us.
I would like to have experts here to evaluate this solution and provide some comments.
Thanks.
Good question. I would be cautious about querying for metadata for every page request. You might also want to be careful storing this data as Page Metadata, as you will need to make sure the values are unique accross all pages/URLs in the publication.
To get around the uniqueness issue, you might want to create an event system which checks/saves the values against some sort of index file when pages are saved.
The file may look something like this:
<?xml version="1.0" encoding="UTF-8"?>
<VanityURLS PublicationID="tcm:0-33-1">
<Page ID="tcm:3-24-64">
<Vanity>/someURL.html</Vanity>
<Vanity>/someotherURL.html</Vanity>
</Page>
<Page ID="tcm:3-25-64">
<Vanity>/someURL.html</Vanity>
<Vanity>/someotherURL.html</Vanity>
</Page>
<VanityURLS>
You could then publish that index file periodically and use it to look up the requested URLs, and map them to page URIs. You could then load the pages via their URIs, or if you want top use your existing code, you can then use the linking API to get the URL from the URI. You could then pass the value to the GetPageMetaByURL() method.
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
The question is simple: it is a good practice we have one "master CSS file" (the same concept of master pages) and, for each page, one specific and unique CSS file?
I ask this because I think that it's useless to have very different code on a page that will not use it — can you all understand me?
From a UI point of view...
Use separate CSS if:
You have almost independent pages with less common stuff
You need to reuse specific pages in different projects
Use single CSS if:
You have lot of common styles
The greatest advantage when using one master CSS file than having a master and several specific CSS files is that
You save on HTTP request times and resources. If you have several files, you need to call your server a few times and waste on the metadata.
Everything is in one place, you get to edit them more easily. CSS becomes more managable for your website.
Caching helps greatly.
The redundant / unused style rules in your master file may be too little to matter much.
In my opinion it is best to have as less number of stylesheet (css) and JavaScript files as possible to reduce number of HTTPS requests.
Having one large css file is better then having 5 different files as most likely the css file will be cached in the user's browser after initial request and cached CSS file will be served after first request.
Yes, it is best practice for the following reason:
When the user loads your website they will take the hit of downloading the singel CSS file on first load - thereafter it will be cached by their browser for every page on your site under your main domain. This means no more loading of the CSS file from the server for surfing your site and faster page loads.
If you have separation concerns from a code structure point of view I would encourage you to consider some CSS pre-compilers such as SASS or LESS that will allow you to structure your code in a nicer way.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I have created my own site. It comprises a MySQL database, some jQuery and a bunch of PHP files. I decided that I needed a CMS because others will be creating content for the site. I thought about making my own, but it seemed a big task when I considered how to code publication workflows, user roles etc. So I looked for a really light-weight CMS, but everything I looked at wanted me to create page templates, which I don't want to do.
So in the end, I installed Drupal, but rather than re-create my site in Drupal I just created two content types for the two pages that hold created content (articles and blogs). Then I simply re-wrote my SQL queries to grab results from the Drupal MySQL tables rather than the MySQL tables that I created originally. It works fine.
I like this approach because I'm not constrained by the Drupal framework, and I don't have to worry about making my own CMS.
My question: is this a commonly used approach? I don't know what other developers do? Thanks.
"is this a commonly used approach?"
No, it is not. You have violated the incapsulation principle.
You can use your own code with Drupal database. But it's better to use the framework as it provides a lot of useful functions: forms creation and validation, DB queries construction etc.
It was well tested and your code may contain bugs.
If you upgrade Drupal and it changes anything in the database structure - your code may break. If you used standard functions, the modifications will probably be hidden inside them.
Be careful now - you are responsible for the database integrity!
Your approach will probably work, and if you had said that you have a complex existing site and you are very limited in time - I would say your approach is fine.
But it seems to me like it is not the case. Given your circumstances, I highly recommend integrating your existing code into Drupal. There are really 2 main reasons why you should do it:
Now you only need the article editing feature. But I'm pretty sure somewhere down the road you will find at least one other feature of Drupal that will save you tons of work.
Integrating your existing code with drupal is really not as hard as you may think...
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
We have a Dynamic CT to render the component output, in it there is a Component Link with link text. While previewing, the output appears to be correct but once we publish the page and hit, the link is not displayed (even the link text).
Both the output format of DCT and the target language has been set as REL but our tcdl:link are not resolved and dynamic component presentations are not rendered. Embedded presentations are getting rendered with page without resolving the tcdl:link tag.
The storage file is pointing to sql db.
Could you pls advise on what else needs to be done?
Perhaps you can edit your question title to be a bit more specific. I assume that you want to have dynamic links resolved in Dynamic Component Presentations using REL. It sounds like you have set things up correctly, but just to make sure this is a quick check list:
You are using Tridion 2011 SP1 (dynamic links in REL DCPs do not resolve in 2011 GA)
The component template output format is REL, and it is set to be dynamic (note the publication target language does not have to be REL)
The component template outputs a component link
Publish a page containing a dynamic component presentation. Check the following:
In the published page content you should see something like <tridion:ComponentPresentation ..../> where the DCP will be inserted
In the database you should see your REL DCP in the COMPONENT_PRESENTATIONS table, this should contain <tcdl:Link...> tag where the link should be
Request the page in the browser. Check that the component presentation is displayed and the link is rendered into an <a../> anchor tag
If not, check the content delivery log files, to see if there are any errors. Also please check that dynamic linking is working on 'normal' pages.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
The reason I'm asking this is I suspect the set of login controls are cumbersome to use/tweak. For example, I'd imagine it'd be hard to tell the user their password is not correct.
No, I never use the built-in ones. But I love starting from scratch in any case, so that might just be me :-)
I always create classes for User, UserPermission, UserNotFoundException, UnauthorizedException, etc. and implement real OOP that just feels right. MVC but not the MVC template.
I use the built in controls. They provide a good amount of configurability and the safety needed for professional development. There are very few points - besides the learning experience - in writing your own.
For example, I'd imagine it'd be hard to tell the user their password is not correct.
It sure can be done very easily. The FailureAction / FailureText / FailureStyle properties are your friends.
Why reinvent the wheel..
I use build in controls provided by asp.net,
for any custom functionality I just inherit the builtin controls.
Cheers!
I've tried using them, and after a while I was ultimately left with just the login control itself. All the logic to authenticate, and manage users was written from scratch. I just didn't want to use the default MembershipProvider that comes with VS.
You can customize the look at feel via CSS, and I believe there's an Authenticate event on the control that you can hook into, to perform your authentication.
If you want your login section to be very different from the standard look and feel, you might want to consider rolling your own. The worst place to end up is to work around the control and not with it.
I use the OOB Login Controls (coupled with some style) and spend my time on the actual substance of the application. Similarly, I don't invent my own logger every time create an application.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Any suggestions?
Possibly something very interactive that I can multiple-select files. Thanks!
plupload - http://www.plupload.com/
supports multiple uploads in every type except basic html4
Allows uploads using HTML5, gears, flash, silverlight, BrowserPlus or plain on HTML4
Uploading files with Ajax isn't possible due to security reasons. There is a work-around with posting files to an iframe, but you can't select multiple files this way.
The solution lies in flash. The two most common flash uploaders are:
swfupload - http://swfupload.org/
uploadify - http://www.uploadify.com/ (jQuery only)
Another option is Uber-Uploader I have used it and it works well with a progress bar.
Or you could use the System.Web.UI.WebControls.FileUpload class in Asp.Net
At this point i'd stay away from flash plugins.
I'd use HTML5 uploader instead like this one:valums uploader
Sure - you'll be able to select multiple files in modern browsers only, otherwise - it'll be file by file. but hey - if person doesn't care about upgrading to newer browsers - they really probably don't know how to Ctrl+click anyways.
Flash doesn't send cookies correctly (it sends IE cookies even if you use firefox or google chrome). So - you'll lose cookies and thus sessions. There is a workaround - to send PHPSESSID in POST requests - but it simply opens door wide open for session fixation.