How $_filter->getHtml() is generated? - php

I need to edit the result of $_filter->getHtml() function.
The $_filter->getHtml() returns an HTML content with ul and li combination for product attributes and I want to apply some modifications to this block.
What I want exactly is to convert some color names (e.g. red) to theirs hex equivalent (FF0A0A).
Do you have any idea on how to change the block contents?

I found the solution :
The output of $_filter->getHtml() can be found in app/design/frontend/base/default/template/catalog/layer/filter.phtml (filter items).

Related

text-orientation in class doesn't apply to tr

i need to show one row's words vertically, for that i've created a class in my stylesheet containing text-orientation:sideways then applied it on the tr , but it won't seem to work, i'm a bit new to CSS so maybe someone could help please
this it the table row
echo "<tr class='vert'>";
and this is the stylesheet
table tr.vert{
text-orientation: sideways;
}
You seem to be missing the writing-mode property..
The text-orientation CSS property sets the orientation of the text characters in a line. It only affects text in vertical mode (when writing-mode is not horizontal-tb). It is useful for controlling the display of languages that use vertical script, and also for making vertical table headers.
MDN
span {
writing-mode: vertical-rl;
text-orientation:sideways;
}
<span>Writing Mode</span>

How to check if a cell has a bottom border with Phpexcel

How to check if a cell has a bottom border using PHPexcel? I am working on a very funky template the sales force of my company have assembled.
The lines could go on and on inside the "Why?" block so that is why I need to check for that last bottom border to move on in my loop.
Example:
This will check the entire G column until it is empty
NumCells = Range("G" & Rows.Count).End(xlUp).Row +1
If Range("G" & NumCells).Borders(xlEdgeBottom).LineStyle = xlContinuous Then
*Continue with code
I ended up using something like this (didn't really find the bottom border a reliable solution). This will just simply grab the data inside of the following cell ranges (B25:B29):
$objPHPExcel->setActiveSheetIndex($sheetIndex)->rangeToArray('B25:B29');

PHP xpath check for div style and its value

I am trying to parse a html file/strings for two things using php and xpath.
<DIV STYLE="top:110px; left:1280px; width:88px" Class="S0">Aug30</DIV>
I tried to look for an unknown value (here: Aug30) with knowing the style top and left value (here: 110px and 1280px).
And the other way. I know the value Aug30 but want to get its values of top and left.
Perhaps XPATH is not the best way to do this. Any idea on how to solve my problem?
Thanks in advance for your help!
To filter <div> element by style attribute value in XPath you can do something like this :
//div[contains(#style, 'top:110px') and contains(#style, 'left:1280px')]
Above XPath will search for <div> node having style attribute value contains two specific strings.
The other requirement isn't supported in XPath 1.0 as far as I can see. We can get the entire value of style attribute, but getting part of it is a dead end. There are some string functions we can use, even though returning a function's result isn't supported.
You'll need to do that using XPath 2.0 or using the host programming language (PHP in this case).

Generating an HTML color code for event category in ai1ec

Although this question relates to a particular Wordpress plugin called the All in One Event Calender by Time.ly it can also be a general PHP related question.
I am trying to modify a theme to use event colours selected in the ai1ec back end and would like to produce a simple HTML colour code - ie "#f2f2f2"
The plugin itself has loads of functions and php shortcodes to pull a wealth of information off each event such as the one listed below.
<?php echo $event->get_category_text_color(); ?> which will print style="color: #f2a011;"
Can also change to print style="background-color: #f2a011;" with the use of $event->get_category_bg_color();
Now the real meat of the question
All I want to do is get that HTML colour so I can also code it into buttons and other visual elements. I have scoured through blogs and code to try and find something that does it to no avail.
What I was wondering is if you could write a filter of some sort to just take the information within the "#f2f2f2" quotation marks. I know it's not called a filter as searches for php filter return information about something completely different - I'm a self taught PHP programmer and so searching for a lot of terms I don't know can be pretty tough!
As pointed above, substr would be a great solution but it wouldn't solve the case where the color code is expressed in this format:
#FFF;
instead of:
#FFFFFF;
Therefore, this regex should do the job quite well:
'/?=#(.*(?=;)))/'
Example:
$matches = array();
preg_match('/?=#(.*(?=;)))/', $event->get_category_text_color(), $matches);
$colorCode = "#{$matches[0]};";
You could use the substr() function like so:
echo substr($event->get_category_text_color(),14,-2);
Which in the example, would return #f2f2f2.

how to print a cell inside a cell using fpdf

I'm making some pdf document from php code using fpdf library. In that document i have created two cell like this
$pdf->Cell(100,100,"Text inside first column",1,0,'L');
$pdf->Cell(35,35,'Text inside second column ',1,0,'C');
above code works well, out put have two cells, first one has size of 100x100 and second has 35x35 , and second cell was just right to the first cell.
but i need to print that second sell inside the first cell
is there any way in fpdf ?
can anyone help me?
I'm not sure what you want exactly achive, but maybe this AddOn could help you to do this:
http://www.interpid.eu/fpdf-table
Other way would be moving the pointer, something like this:
$pdf->Cell(100,100,"Text inside first column",1,0,'L');
$pdf->SetX($pdf->GetX() - 35);
$pdf->Cell(35,35,'Text inside second column ',1,0,'C');
In Nested cell X-axis and Y-axis, I have achieved like this
`$pdf->Cell(190,20,"",1,0,'L');
$pdf->SetX($pdf->GetX() - 189);
$pdf->Cell(100,10,'First ',2,0,'L');
$pdf->Cell(90,10,'March/2020 ',2,0,'R');
$pdf->SetY($pdf->GetY() +5);
$pdf->Cell(100,10,'MCB,UBl Omni, HBL Konnect, Alfalah , Mobi Cash ',2,0,'L');
$pdf->SetY($pdf->GetY() +5);`enter code here`
$pdf->Cell(139,10,'third text he`enter code here`re ',2,0,'L');
$pdf->Cell(50,10,'Lahore',2,0,'R');`

Categories