Where does VM derive code for $file_list? - joomla

Can someone tell me where the code for $file_list is sourced in Virtuemart? To be specific, in the flypage.tpl.php file, there is a snippet of code that looks like this:
<span style="font-style: italic;">
<?php echo $file_list ?>
</span>
This code generates the HTML for files that have been linked to the product. Unfortunately, the formatting of that section is pretty ugly by default and I'm trying to figure out how to modify the source. Can't find it to save my soul. It doesn't appear to be anywhere in the template files.

it should be here:
administrator/com_virtuemart\classes\ps_product_files.php
and search for function get_file_list
Right under this function (row 622 - 626) should be html template for product files.
Also hate this non MVC architecture. Looking forward to VM 2.0

Related

Custom sections Umbraco

Not even sure I labeled this correctly, I am in the process of converting a site to Umbraco, and there are sections of the site that needs to be edited using the CMS tools in the back end, basically it is a grid with pictures and description text
Here is a sample of the HTML
<div class="hi-icon-effect-1 hi-icon-effect-1a">
<a class="hi-icon">
<img class="img-responsive " id="ImgSales" src="../../Images/sales_icon_circle_grey.png" alt="">
</a>
<p style="padding-left:5px;" id="lblSales" class="">Sales</p>
</div>
What I would like to be able to do is go to the content section of the admin and edit the list of items and configure the image and text for each item.
http://www2.strikemedia.co.za/
If you view the above link and scroll down there will be a grid of items (services) and it is this list that I want to be able to generate.
I am comfortable with all the technologies used in Umbraco, I just do not know the system well enough to do these kinds of modifications, can someone please assist or point me to the resources that will help me build this.
Thanks
You should take a look at the Archetype package: https://our.umbraco.org/projects/backoffice-extensions/archetype/
As far as I understand your question you are looking for a way to add X amount of similar items to the contents of a page - for this, Archetype is probably perfect :-)
Once you have your list of items added inside Umbraco, look here: https://github.com/kgiszewski/ArchetypeManual/blob/master/03%20-%20Template%20Usage.md
Use case #1 in this example will allow you to iterate through items and output it with whatever "template" you want (aka the HTML sample you provided).

CKEDITOR's source code mode scrambles custom template code

I'm trying to allow custom "template code" within the source code editor. My code snippets would always look like {* anything here *}. It mostly works, but if used inside an HTML tag things gets scrambled.
I'm already using allowedContent: true, when starting CKEDITOR.
Example:
<p style="{* some "short code" of mine... *}">Text</p>
turns into
<p style="{* some " short="" code"="" of="" mine...="" *}"="">Text</p>
And
<p {* tet_pos_is_inside *}>Fuss</p>
into
<p {*="" tet_pos_is_inside="" *}="">Fuss</p>
Any advise ?
Thanks,
Sebastian
My advise would be to never use them inside tags, it sounds like a nightmare to configure. What is the requirement you are trying to fill with those?
You could go around this issue with pre- and post processing using classes, data attributes and/or custom attributes. For example you could use something like his:
<p class="tet_pos_is_inside_val-12345 foo-val-12345">I love horses</p>
<p data-tet_pos_is_inside="12345" data-foo="">I love bunnies</p>
<p tet_pos_is_inside="12345" foo="">I love cats</p>
Well,
apparently there was a simple solution to solve my current problem:
<p style="{* some 'short code' of mine... *}">Text</p>
works ! Note the use of singe-quotes inside the double quotes.
IOW, as long as there is a <tag attr="val"> then val can be anything except containing more double quotes.
Thanks for the comments.

How to style Joomla 2.5 article's intro text?

It's very strange but I haven't found a really good solution by googling joomla style intro text.
I want that the current output:
<div class="item-content">
<p>Intro Text</p>
<p>Full Text</p>
</div>
to be replaced by:
<div class="item-content">
<div class="introtext"><p>Intro Text</p></div>
<div class="fulltext"><p>Full Text</p></div>
</div>
I was sure that Joomla itself should have declared such a class for introtext or at least should have a configurable option for that.
What I do NOT want:
A Joomla 1.x or Joomla 1.5 solution
A manual way until there is not
an extension-base solution (which is more more strange!)
UPDATE after {THIS} answer
Now I have a problem with $this->item->introtext, $this->item->fulltext and $this->item->text.
I expect $this->item->introtext to show ONLY introtext, but it also contains the contents AFTER READ MORE.
What property should I use to only include contents BEFORE READ MORE, not anything else?
I don't expect that the $this->item->introtext content be affected by Show Intro Text parameter in article options. It is expected that only $this->item->text cares about it. Am I right?
Note: $this->item->fulltext works as expected and outputs only the contents AFTER the READ MORE.
In case of disabling Show Intro Text parameter in article options, all of the 3 variables, return the text after READ MORE. This should really be considered as a bug.
It would be more wisely to have a variable to return only intro text (in any situation), a variable to return only full text (in any situation), and a variable to include/exclude introtext according to the article parameter: Show Intro Text
All you need to do is add a template override. You need to make a copy of this file:
/JOOMLA INSTALL/components/com_content/views/article/tmpl/default.php
Make any changes to the code that you want, then upload it here:
/JOOMLA INSTALL/templates/flexibility/html/com_content/article/default.php
Simple as that.
In Joomla 3.3.0 it just works as you expected:
<div id="introtext"><?php echo$this->item->introtext; ?></div>
<div id="fulltext"><?php echo $this->item->fulltext; ?></div>
(in templates/your_template_name/html/com_content/article/default.php)

How to fetch() sub-parts of a Smarty template

Background Smarty is a templating engine that separates the presentation layer from the logic layer of web applications. It is well-suited for the Model-View-Control approach to developing web applications. The View can be represented by Smarty templates, which contain only HTML and Smarty tags. The Control can be implemented by PHP files that serve the appropriate views based on the logic contained within them via PHP code. The View is instantiated by displaying the templates via the display() command. Alternatively, a template can be read in as a variable without displaying it via the fetch() command. The file name of the template is the argument to both these commands.
Issue The fetch() command can read an entire template. In order to read parts/sub-parts of a template, each of these parts would normally needed to be stored in a separate file with its own name that can be the argument to the command. This creates needless files.
Question Is it possible to fetch only parts of a Smarty template by somehow marking sections of the template?
Case example Below I present a sample template file with Smarty and HTML tags, as well as the corresponding controller file with PHP code.
Template file (index.tpl)
<html>
<body>
<div id="sec1">
First section
</div>
<div id="sec2">
Second section
</div>
</body>
</html>
Controller file (index.php)
<?php
$smarty = new Smarty;
$template = $smarty->fetch("index.tpl");
?>
In the example above, the $template variable would contain the full output from the template page. Below is a dump of its contents from the example.
$template => string(255)
"<html><body>
<div id="sec1">First section</div>
<div id="sec2">Second section</div>
</body></html>"
However, suppose I wish to read in the code from each of the DIV containers separately, and store them into separate variables, how could I achieve this? For instance, suppose I have a magical function called fetch_sub(). Here's my expectations of using it.
<?php
$smarty = new Smarty;
$div1 = $smarty->fetch_sub("index.tpl", "sec1");
$div2 = $smarty->fetch_sub("index.tpl", "sec2");
?>
Then $div1, etc would contain only the relevant sub-part, instead of the whole template.
Other info I am not a beginner with Smarty and have a fairly good handle on basic concepts, as well as some of Smarty's advanced concepts. Following is my attempts so far at conceptualizing the problem and getting to a solution. My initial rough idea is to demarcate the template into sections using {capture}, and then somehow reference each of these sections. I present an outline example of the idea below.
{capture name=sec1}
<div id="sec1">
First section
</div>
{/capture}
. . .
Smarty (as of Smarty 3.1) has no built-in feature to allow you achieving your goal. I had proposed something similar in 2011, but we haven't come around to implementing it.
Maybe you can have the generated HTML parsed to DOM and help yourself with xpath, or something like that?
You can try this:
sec1.tpl
<div id="sec1">First section</div>
sec2.tpl
<div id="sec2">Second section</div>
index.tpl
<html><body>
{include file="sec1.tpl"}
{include file="sec2.tpl"}
</body></html>
And then You can fetch parts by invoking:
$smarty = new Smarty;
$div1 = $smarty->fetch("sec1.tpl");
$div2 = $smarty->fetch("sec2.tpl");

I can't find the proper css in joomla

I need to modify the width of each column in a 2 column custom theme and can't find the place to do this. I tried using firebug but no luck. I looked over the main joomla css (didn't quite expect it to be there), and the theme template.css.
I'm sure veteran joomla programmers have ran into this plenty of times and this is an easy solve for them :P
I just need to know the places to look.
Thanks.
If you're using firebug and you still can't find the path to the css file, may be you have some kind of plugin or template that packs all your style sheets into a single file?
If so, you should disable it, clear your cache, then try again with firebug, and once you find where is the css file located, enable the plugin / template feature again.
If you still can't find it, can you post the url here to take a look?
I hope it helped!
Maybe there's no css for this.
Sometimes the width of columns in articles is inside de template itself like this:
<td valign="top" width="<?php echo intval(100 / $this->params->get('num_columns')) ?>%" class="article_column<?php echo $divider ?>">
<?php for ($y = 0; $y < ($this->params->get('num_intro_articles') / $this->params->get('num_columns')); $y ++) :
if ($i < $this->total && $i < ($numIntroArticles)) :
$this->item =& $this->getItem($i, $this->params);
echo $this->loadTemplate('item');
$i ++;
endif;
endfor; ?>
</td>
To find something like this code look into:
template folder/ content/ com_content / the view you want to edit (i.e. : section view, category view etc)...
Also if you use Firebug or Webkit Inspector you should see the inline style as a result of this code.
If you use firebug, you should definitely see the path of the particular css. Just right-click on some column -> click on inspect element and then you see the css path on the right-hand side.
If your column styles are set inline, you will have to modify the right template for this. Its probably your index.php in your themes root folder or some template in the html folder.

Resources