โปรแกรม
joomla เป็นโปรแกรมที่ขายสินค้าออนไลน์แบบสำเร็จรูปโดยผู้ใช้งานไม่ต้องเขียน โปรแกรมเลย ทำให้สะดวกสบายต่อการใช้งานมากๆครับ และ นักพัฒนานั้นก็จะเขียน ฟังก์ชันต่าง ๆ รวมไปถึง
css การแสดงผลของสินค้า หรือ รูปแบบต่างๆ ของสินค้าที่ทำให้สินค้าน่าสนใจมากขึ้น CSS คืออะไร คือภาษาที่ใช้เป็นส่วนของการจัดรูปแบบการแสดงผลต่าง ๆ ไม่ว่าจะเป็นข้อความ สี ต่างๆ ก็ใช้ css ในการทำงานได้ปรับแต่งให้สวยงามได้ และในบทความนี้ผมจะมานำเสนอ เกี่ยวกับ ตัว breadcrumb ที่บอกเต็บว่า เราอยู่ในขั้นตอนใด ของการซื้อสินค้า
ก็คือ อย่างแรก เรามีไฟล์ css แล้วนำโค้ดนี้ไปใส่ในไฟล์ css ของเรา
โค้ด: เลือกทั้งหมด
#breadcrumb {
list-style: none;
display: inline-block;
}
#breadcrumb .icon {
font-size: 14px;
}
#breadcrumb li {
float: left;
}
#breadcrumb li a {
color: #FFF;
display: block;
background: #e7325a;
text-decoration: none;
position: relative;
height: 40px;
line-height: 40px;
padding: 0 10px 0 5px;
text-align: center;
margin-right: 23px;
}
#breadcrumb li:nth-child(even) a {
background-color: #e7325a;
}
#breadcrumb li:nth-child(even) a:before {
border-color: #e7325a;
border-left-color: transparent;
}
#breadcrumb li:nth-child(even) a:after {
border-left-color: #e7325a;
}
#breadcrumb li:first-child a {
padding-left: 15px;
-moz-border-radius: 4px 0 0 4px;
-webkit-border-radius: 4px;
border-radius: 4px 0 0 4px;
}
#breadcrumb li:first-child a:before {
border: none;
}
#breadcrumb li:last-child a {
padding-right: 15px;
-moz-border-radius: 0 4px 4px 0;
-webkit-border-radius: 0;
border-radius: 0 4px 4px 0;
}
#breadcrumb li:last-child a:after {
border: none;
}
#breadcrumb li a:before, #breadcrumb li a:after {
content: "";
position: absolute;
top: 0;
border: 0 solid #e7325a;
border-width: 20px 10px;
width: 0;
height: 0;
}
#breadcrumb li a:before {
left: -20px;
border-left-color: transparent;
}
#breadcrumb li a:after {
left: 100%;
border-color: transparent;
border-left-color: #e7325a;
}
#breadcrumb li a:hover {
background-color: #e65272;
}
#breadcrumb li a:hover:before {
border-color: #e65272;
border-left-color: transparent;
}
#breadcrumb li a:hover:after {
border-left-color: #e65272;
}
#breadcrumb li a:active {
background-color: #e65272;
}
#breadcrumb li a:active:before {
border-color: #e65272;
border-left-color: transparent;
}
#breadcrumb li a:active:after {
border-left-color: #e65272;
}
หลังจากนั้นให้เรียกใช้งานไฟล์ CSS
โค้ด: เลือกทั้งหมด
<?php
$document = JFactory::getDocument();
$document->addStyleSheet('/helix3/templates/shaper_helix3/css/mooziicart.css');
?>
ตัวอย่างโค้ดทดลองใช้ ว่า css เข้ามาในไฟล์หรือยัง
โค้ด: เลือกทั้งหมด
<ul id="breadcrumb">
<li><a href="#"><span class="icon icon-home"> </span></a></li>
<li><a href="#"><span class="icon icon-beaker"> </span> Projects</a></li>
<li><a href="#"><span class="icon icon-double-angle-right"></span> Breadcrumb</a></li>
<li><a href="#"><span class="icon icon-rocket"> </span> Getting started</a></li>
</ul>
ต่อมาในการใช้งานก็ถ้าเรามีโค้ดที่เป็น Orderstep อยุ่แล้วก็ให้ นำโค้ดตัวอย่างนี้ไปแก้ไขได้ครับ
- กำหนด id ให้เหมือนใน css
- โค้ดนี้ผมมี อยู่ 4 สเต็บครับก็เลยก็เลยใส่เป็น loop ไปครับ
โค้ด: เลือกทั้งหมด
<ul id = "breadcrumb">
<?php foreach($this->steps as $k=>$step){?>
<li> <a class = "jshop_order_step <?php print $this->cssclass[$k]?>">
<?php print $step;?> </a></li>
<?php }?>
</ul>
ผลลัพธ์ท่ี่ได้
- Selection_999(511).png (4.66 KiB) Viewed 811 times
โปรแกรม [url=https://www.mindphp.com/%E0%B8%84%E0%B8%B9%E0%B9%88%E0%B8%A1%E0%B8%B7%E0%B8%AD/73-%E0%B8%84%E0%B8%B7%E0%B8%AD%E0%B8%AD%E0%B8%B0%E0%B9%84%E0%B8%A3/2620-joomla-cms.html]joomla[/url] เป็นโปรแกรมที่ขายสินค้าออนไลน์แบบสำเร็จรูปโดยผู้ใช้งานไม่ต้องเขียน โปรแกรมเลย ทำให้สะดวกสบายต่อการใช้งานมากๆครับ และ นักพัฒนานั้นก็จะเขียน ฟังก์ชันต่าง ๆ รวมไปถึง [url=https://mindphp.com/%E0%B8%84%E0%B8%B9%E0%B9%88%E0%B8%A1%E0%B8%B7%E0%B8%AD/73-%E0%B8%84%E0%B8%B7%E0%B8%AD%E0%B8%AD%E0%B8%B0%E0%B9%84%E0%B8%A3/2193-css-%E0%B8%84%E0%B8%B7%E0%B8%AD%E0%B8%AD%E0%B8%B0%E0%B9%84%E0%B8%A3.html]css[/url] การแสดงผลของสินค้า หรือ รูปแบบต่างๆ ของสินค้าที่ทำให้สินค้าน่าสนใจมากขึ้น CSS คืออะไร คือภาษาที่ใช้เป็นส่วนของการจัดรูปแบบการแสดงผลต่าง ๆ ไม่ว่าจะเป็นข้อความ สี ต่างๆ ก็ใช้ css ในการทำงานได้ปรับแต่งให้สวยงามได้ และในบทความนี้ผมจะมานำเสนอ เกี่ยวกับ ตัว breadcrumb ที่บอกเต็บว่า เราอยู่ในขั้นตอนใด ของการซื้อสินค้า
ก็คือ อย่างแรก เรามีไฟล์ css แล้วนำโค้ดนี้ไปใส่ในไฟล์ css ของเรา
[code=php]#breadcrumb {
list-style: none;
display: inline-block;
}
#breadcrumb .icon {
font-size: 14px;
}
#breadcrumb li {
float: left;
}
#breadcrumb li a {
color: #FFF;
display: block;
background: #e7325a;
text-decoration: none;
position: relative;
height: 40px;
line-height: 40px;
padding: 0 10px 0 5px;
text-align: center;
margin-right: 23px;
}
#breadcrumb li:nth-child(even) a {
background-color: #e7325a;
}
#breadcrumb li:nth-child(even) a:before {
border-color: #e7325a;
border-left-color: transparent;
}
#breadcrumb li:nth-child(even) a:after {
border-left-color: #e7325a;
}
#breadcrumb li:first-child a {
padding-left: 15px;
-moz-border-radius: 4px 0 0 4px;
-webkit-border-radius: 4px;
border-radius: 4px 0 0 4px;
}
#breadcrumb li:first-child a:before {
border: none;
}
#breadcrumb li:last-child a {
padding-right: 15px;
-moz-border-radius: 0 4px 4px 0;
-webkit-border-radius: 0;
border-radius: 0 4px 4px 0;
}
#breadcrumb li:last-child a:after {
border: none;
}
#breadcrumb li a:before, #breadcrumb li a:after {
content: "";
position: absolute;
top: 0;
border: 0 solid #e7325a;
border-width: 20px 10px;
width: 0;
height: 0;
}
#breadcrumb li a:before {
left: -20px;
border-left-color: transparent;
}
#breadcrumb li a:after {
left: 100%;
border-color: transparent;
border-left-color: #e7325a;
}
#breadcrumb li a:hover {
background-color: #e65272;
}
#breadcrumb li a:hover:before {
border-color: #e65272;
border-left-color: transparent;
}
#breadcrumb li a:hover:after {
border-left-color: #e65272;
}
#breadcrumb li a:active {
background-color: #e65272;
}
#breadcrumb li a:active:before {
border-color: #e65272;
border-left-color: transparent;
}
#breadcrumb li a:active:after {
border-left-color: #e65272;
}
[/code]
หลังจากนั้นให้เรียกใช้งานไฟล์ CSS
[code=php]<?php
$document = JFactory::getDocument();
$document->addStyleSheet('/helix3/templates/shaper_helix3/css/mooziicart.css');
?>[/code]
ตัวอย่างโค้ดทดลองใช้ ว่า css เข้ามาในไฟล์หรือยัง
[code=php]<ul id="breadcrumb">
<li><a href="#"><span class="icon icon-home"> </span></a></li>
<li><a href="#"><span class="icon icon-beaker"> </span> Projects</a></li>
<li><a href="#"><span class="icon icon-double-angle-right"></span> Breadcrumb</a></li>
<li><a href="#"><span class="icon icon-rocket"> </span> Getting started</a></li>
</ul>[/code]
ต่อมาในการใช้งานก็ถ้าเรามีโค้ดที่เป็น Orderstep อยุ่แล้วก็ให้ นำโค้ดตัวอย่างนี้ไปแก้ไขได้ครับ
- กำหนด id ให้เหมือนใน css
- โค้ดนี้ผมมี อยู่ 4 สเต็บครับก็เลยก็เลยใส่เป็น loop ไปครับ
[code]<ul id = "breadcrumb">
<?php foreach($this->steps as $k=>$step){?>
<li> <a class = "jshop_order_step <?php print $this->cssclass[$k]?>">
<?php print $step;?> </a></li>
<?php }?>
</ul>[/code]
ผลลัพธ์ท่ี่ได้
[attachment=0]Selection_999(511).png[/attachment]