Customizing CSL Editor inline citation for multiple - inline

I am trying to edit one of the preexisting citation style in NP++. I want to change [1],[2],[3],[5],[8] and [1-3],[5],[8] to [1,2,3,5,8]. My coding abilities are below normal. Please suggest how can I do this.

your best bet here is to use the CSL editor, see our intro guide here: http://support.mendeley.com/customer/portal/articles/895771-getting-started-with-the-visual-csl-editor
Specifically, you'll want to edit your style, then click 'Layout' under 'Inline Citations' and add a [ prefix and a ] suffix. Then, expand the 'Layout' node and click the 'Group', then remove the [ prefix and the ] suffix.
You can then save the citation style as explained in the above link.
If that doesn't help or you have problems, you might get a quicker response if you contact us through our support page: support.mendeley.com

Related

How to custom placeholder in international phone number plugin

I have problem with custom placeholder. I am using this https://github.com/mareczek/international-phone-number I want to add more ex. E.g. 131123456789 to my place holder which default gave something like this 131123456789. I read the document they use customPlaceholder to custom place holder, but they do not have any example with angularjs, so could someone show me example code with custom place holder like this.
Here my code that I added to my app
app.config([
'$stateProvider',
ipnConfig,
register_form_state
])->ipnConfig.customPlaceholder = 'E.g. 131123456789'
but it doesn't work for me.
This will solve this problem
http://hodgepodgers.github.io/ng-intl-tel-input/
Please refer this link & this is angularJS plugin
https://github.com/hodgepodgers/ng-intl-tel-input
On selection of country, placeholder will change
The documentation for http://hodgepodgers.github.io/ng-intl-tel-input/ is lacking, but it seems like it could be a good tool. I think I would personally like to see a working implementation inside of an existing application before I'd rule it as the solution to use. I'm still having trouble implementing this one compared to the one by mareczek.
edit To answer your question, I think that it changes the placeholder based on the flag you have selected. If you have it set to a default country, can you not just change the placeholder in the html? Or can you target it directly using css?

Multiple phrases per language in cakephp

I am creating a website using CakePHP that requires translation not only into multiple languages but also multiple phrases per language depending on the type of the logged in user. This will allow the same functionality but with more formal or more friendly language without duplication.
As a very simple example:
Type 1: "Customer", "purchase","shopping cart"
Type 2: "Client", "buy", "basket"
Type 3: "User", "order","invoice"
Each of these types would be available in multiple languages.
I've got the standard localization working in CakePHP (one of the reasons I chose it!) and have the appropriate default.po files in the /Locale/[lang]/LC_MESSAGES/ directory and all is working fine there (thank you to the user who noted on this site that ger needed to be deu to work ;) ).
Before I get too far into the app I'd like to add the phrasing so I can set e.g. the language as French and phrasing as type2. If I was doing this outside of a framework I'd have a matrix look-up to find the correct string based on language and phrase keys but am unsure of how to do this within CakePHP's localization.
Currently I'm using the standard __([string]) convention but as this is early in the development cycle it would be trivial to change if necessary.
I was considering using __d([phrase],[string]) but can't see how to set this without creating my app as a plugin and then I'm back to the same problem with /Locale/
I have been unable to find any example of this in my searches on SO or the cakePHP community sites so would be grateful for any suggestions.
Is there a standard way to do this within cakePHP? if not, what would be a good "best practice" way to implement this?
Edit - following the answer below here's how it was implemented:
in /app/Locale/[lang]/LC_MESSAGES/ I created a new .po files with the new phrasing in them as phrase1.po, phrase2.po etc.
Where I set the language I also set the phrasing where the phrase file matches the name of the po file:
Configure::write('Config.language', 'deu');
Configure::write('App.langDomain', 'phrase1');
and all strings were wrapped with:
__d(Configure::read('App.langDomain', 'string')
And it just works.
Use __d() like this:
__d(Configure::read('App.langDomain'), 'Some string');
In bootstrap.php check the conditions and set App.langDomain based on whatever you need.
__d() has nothing to do with plugins, you can use it everywhere.
And alternative would be to wrap your translations with a custom method, something like
__dd(Configure::read('App.langDomain'), array('foo' => __('String1', 'bar' => __('String2'));
The array is an array of langDomain => stringForThatDomain mappings. Your __dd() method would take the one that is passed in the first argument.

How to add a custom field into template.php using Zen sub theme

First time poster here, I'm a designer not skilled at all with php and I have a small issue I don't seem to be able to solve. I'm making a site in drupal 7 using a sub theme on zen.
Btw this is a great CMS, even though people say it's really more a developers CMS. I have no trouble to do what I need using views, rules, display suite etc. So a big thank you for all the developers out there making this such a good CMS. But for this apparently simple problem... no module will help me (I think) and I'm kinda stuck.
So here it is: I'd like to add a subtitle next to the title in all my pages.
So what I did was to add a custom field into the content type basic page (machine name: field_sub_title) which is a simple text field.
I uncommented the following line in my template.php
function mytheme_preprocess_page(&$variables, $hook) {
$variables['sub_title'] = t('field_sub_title');
}
Now my question is how do I load the content of my custom field into that variable?
I know i need to change the second part, but I don't have a clue as into what I need to change this.
Displaying the variable into the the page.tpl.php is something I know about so I only need help with the first part.
{EDIT}
Ok I found how to do this :)
I was looking for a solution in the wrong place. I don't need to change any thing in the template.php file.
Just needed to add this bit of code into my page.tpl.php:
<?php
print $node->field_sub_title['und'][0]['value'];
?>
So I'm posting this here for other Drupal newbies struggling with this....
Your solution may work for now, but there may be a more Drupal-y way to handle a problem like this. If you haven't noticed any problems yet, you may find one or more of the following issues down the road:
Someone who doesn't know php or Drupal theming may need to change the way this works.
If you're like me, you may forget where exactly in code this was implemented.
You may see superfluous markup and/or errors on nodes (content) that do not have this sub-title field (ie. event content not having a sub-title field while basic pages and news articles do).
When you add a field to a content type, it will automatically appear anytime content in that content type is displayed. You should be able to add the sub-title field for your page, event or whatever else you need and have it automatically appear in the markup.
You can 'manage display' of a content type to drag and drop the order for fields to appear. You could take it a step further by using a module like Display Suite to add formatting or layout per-content type.
If you feel like this isn't good enough and the markup for the subtitle must be at the same level as the page title (which is rare), at least add an if statement to make your code check to see if the variable is present before trying to print it. I'd also add a new variable and comments for code readability.
<?php
$subtitle = $node->field_sub_title['und'][0]['value'];
if($subtitle){
print $subtitle;
}
?>
Consider using field_get_items or field_view_value, or at least use the LANGUAGE_NONE constant instead of 'und'
See https://api.drupal.org/api/drupal/modules%21field%21field.module/function/field_get_items/7 and https://api.drupal.org/api/drupal/modules!field!field.module/function/field_view_value/7
This has the added benefit of reducing the number of potential security holes you create.

CakePHP $this->element correct usage?

I'm trying to make a reusable component (a weekday dropdown box, simple as pie) and am following the advice in http://book.cakephp.org/view/1081/Elements.
According to that page, I should make a blah.ctp file in app/views/elements, and it will be magically accessible in my view code as $this->element('blah').
So I did it. I'm passing the form and field name to my element in the view code:
$this->element(
'weekday_input',
array('form'=>$this->Form, 'fieldname'=>'weekday')
);
Earlier I created a form using $this->Form->create, so I figured I need to pass it to the element explicitly.
And my element code, in weekday_input.ctp:
echo $form->input(
$fieldname,
array(
'options',
array('Sunday'=>'Sunday',...,'Saturday'=>'Saturday')
)
);
(Weekdays in between omitted for brevity.)
Am I using $this->element properly? Is there something more clean available?
You don't have to pass the Form object. Form, Html and other helpers are available in elements (just as in view). Whether or not you want to pass fieldname depends: Do you need to change it?
An element is a bit too simple I expect. Also it is not very testable. Would focus on Helpers, which is a more advanced way of developing this. But there is another solution I would prefer even more:
For this kind of issues it might be more appropriate to extend the formhelper itself. You can see a simple example here:
http://blog.nlware.com/2012/02/07/cakephp-2-0-how-to-extend-the-formhelper/
A full example can be found for example here:
https://github.com/slywalker/cakephp-plugin-boost_cake/blob/master/View/Helper/BoostCakeFormHelper.php
As you asked for a clean solution think about creating a plugin (or check out existing plugins). That will separate the code out of your project more clean. And it will be available for re-use without much issues.
you can find all files needed for a plugin in the same project:
https://github.com/slywalker/cakephp-plugin-boost_cake
And the documentation here:
http://book.cakephp.org/2.0/en/plugins.html

Add custom link to operations in 'admin/content'

Can someone give me a suggestion on how to add another link to the "operations"-cell on admin/node?
I have written a module which copies a specific node and now i need in addition to the links "edit" and "delete" a "copy"-link.
CanĀ“t find any useful hints in the Drupal API.
The solution is to download admin_menu module. It contains administration views (you also need to enable it in Modules), which changes default content grid to the custom view. You can then go to Views and modify the admin/content view as you want.
If by "admin/node" you actually mean "admin/content/node", I think you're looking for hook_node_operations().
http://api.drupal.org/api/drupal/modules!node!node.api.php/function/hook_node_operations/7

Resources